ui redesign, marks v1 done, gonna build the next release
This commit is contained in:
@@ -23,7 +23,7 @@ import androidx.fragment.app.DialogFragment
|
|||||||
class AboutFragment : DialogFragment() {
|
class AboutFragment : DialogFragment() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setStyle(STYLE_NORMAL, R.style.Theme_Solen_PrimaryStatusBar)
|
setStyle(STYLE_NORMAL, R.style.Theme_Solen)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
|||||||
@@ -5,15 +5,14 @@ import android.content.res.Resources
|
|||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.graphics.drawable.GradientDrawable
|
import android.graphics.drawable.GradientDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.ViewTreeObserver
|
import android.view.ViewTreeObserver
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.ImageView
|
||||||
import android.widget.LinearLayout
|
import android.widget.LinearLayout
|
||||||
import android.widget.RelativeLayout
|
|
||||||
import android.widget.ScrollView
|
import android.widget.ScrollView
|
||||||
import android.widget.Space
|
import android.widget.Space
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
@@ -40,7 +39,15 @@ class CalWeekFragment : Fragment() {
|
|||||||
adapter.addFragment(DayFragment(i))
|
adapter.addFragment(DayFragment(i))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewPager.registerOnPageChangeCallback(object : ViewPager2.OnPageChangeCallback() {
|
||||||
|
override fun onPageSelected(position: Int) {
|
||||||
|
super.onPageSelected(position)
|
||||||
|
Vars.selectedDay = position
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
viewPager.adapter = adapter
|
viewPager.adapter = adapter
|
||||||
|
viewPager.currentItem = Vars.selectedDay
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
@@ -102,10 +109,41 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
|
|
||||||
rootLayout.addView(nameDateTextView)
|
rootLayout.addView(nameDateTextView)
|
||||||
|
|
||||||
for (subj in day.subjects) {
|
var prevSubj = Subject()
|
||||||
|
prevSubj.name = ""
|
||||||
|
prevSubj.place = ""
|
||||||
|
prevSubj.substitute = ""
|
||||||
|
prevSubj.teacher = ""
|
||||||
|
prevSubj.number = ""
|
||||||
|
prevSubj.start = ""
|
||||||
|
prevSubj.end = ""
|
||||||
|
prevSubj.free = false
|
||||||
|
|
||||||
|
var firstDone = false
|
||||||
|
|
||||||
|
for ((i, subj) in day.subjects.withIndex()) {
|
||||||
val subjectBackground = when (subj.substitute) {
|
val subjectBackground = when (subj.substitute) {
|
||||||
"0" -> if (subj.place != "Volno") {
|
"0" -> if (subj.place != "Volno") {
|
||||||
R.color.cal_week_subject
|
R.color.primary_transparent_bg
|
||||||
|
} else {
|
||||||
|
R.color.cal_week_free_transparent_bg
|
||||||
|
}
|
||||||
|
"1" -> if (subj.place != "Volno") {
|
||||||
|
R.color.cal_week_substitute_transparent_bg
|
||||||
|
} else {
|
||||||
|
R.color.cal_week_free_transparent_bg
|
||||||
|
}
|
||||||
|
"2" -> if (subj.place != "Volno") {
|
||||||
|
R.color.cal_week_event_transparent_bg
|
||||||
|
} else {
|
||||||
|
R.color.cal_week_free_transparent_bg
|
||||||
|
}
|
||||||
|
else -> R.color.primary_transparent_bg
|
||||||
|
}
|
||||||
|
|
||||||
|
val subjectStroke = when (subj.substitute) {
|
||||||
|
"0" -> if (subj.place != "Volno") {
|
||||||
|
R.color.primary
|
||||||
} else {
|
} else {
|
||||||
R.color.cal_week_free
|
R.color.cal_week_free
|
||||||
}
|
}
|
||||||
@@ -119,7 +157,7 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
} else {
|
} else {
|
||||||
R.color.cal_week_free
|
R.color.cal_week_free
|
||||||
}
|
}
|
||||||
else -> R.color.cal_week_subject
|
else -> R.color.primary
|
||||||
}
|
}
|
||||||
|
|
||||||
val subjectDrawable = GradientDrawable()
|
val subjectDrawable = GradientDrawable()
|
||||||
@@ -131,26 +169,34 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
requireContext(),
|
requireContext(),
|
||||||
subjectBackground
|
subjectBackground
|
||||||
)
|
)
|
||||||
) // Use your desired background color
|
)
|
||||||
|
subjectDrawable.setStroke(
|
||||||
|
10,
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
subjectStroke
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val subjectLayout = LinearLayout(requireContext())
|
val subjectLayout = LinearLayout(requireContext())
|
||||||
subjectLayout.orientation = LinearLayout.HORIZONTAL
|
subjectLayout.orientation = LinearLayout.HORIZONTAL
|
||||||
subjectLayout.gravity = Gravity.CENTER_VERTICAL
|
subjectLayout.gravity = Gravity.CENTER_VERTICAL
|
||||||
subjectLayout.background = subjectDrawable
|
subjectLayout.background = subjectDrawable
|
||||||
|
|
||||||
val subjectRelativeLayout = RelativeLayout(requireContext())
|
|
||||||
subjectRelativeLayout.layoutParams = RelativeLayout.LayoutParams(
|
|
||||||
RelativeLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
RelativeLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
|
||||||
|
|
||||||
val subjectNumberDrawable = GradientDrawable()
|
val subjectNumberDrawable = GradientDrawable()
|
||||||
subjectNumberDrawable.shape = GradientDrawable.RECTANGLE
|
subjectNumberDrawable.shape = GradientDrawable.RECTANGLE
|
||||||
subjectNumberDrawable.cornerRadius = resources.getDimension((R.dimen.corner_radius))
|
subjectNumberDrawable.cornerRadius = resources.getDimension(R.dimen.corner_radius)
|
||||||
subjectNumberDrawable.setColor(
|
subjectNumberDrawable.setColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.cal_week_bg
|
subjectBackground
|
||||||
|
)
|
||||||
|
)
|
||||||
|
subjectNumberDrawable.setStroke(
|
||||||
|
10,
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
subjectStroke
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -159,7 +205,7 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
subjectNumberTextView.text = subj.number
|
subjectNumberTextView.text = subj.number
|
||||||
subjectNumberTextView.textSize = 30f
|
subjectNumberTextView.textSize = 30f
|
||||||
subjectNumberTextView.setPadding(20, 20, 20, 20)
|
subjectNumberTextView.setPadding(20, 20, 20, 20)
|
||||||
subjectNumberTextView.gravity = Gravity.CENTER_VERTICAL // Center text vertically
|
subjectNumberTextView.gravity = Gravity.CENTER // Center text vertically
|
||||||
subjectNumberTextView.setTextColor(
|
subjectNumberTextView.setTextColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
@@ -170,9 +216,10 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
|
|
||||||
val frameLayout = FrameLayout(requireContext())
|
val frameLayout = FrameLayout(requireContext())
|
||||||
val layoutParams = LinearLayout.LayoutParams(
|
val layoutParams = LinearLayout.LayoutParams(
|
||||||
FrameLayout.LayoutParams.WRAP_CONTENT,
|
120,
|
||||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
)
|
)
|
||||||
|
frameLayout.foregroundGravity = Gravity.CENTER
|
||||||
frameLayout.layoutParams = layoutParams
|
frameLayout.layoutParams = layoutParams
|
||||||
|
|
||||||
frameLayout.addView(subjectNumberTextView)
|
frameLayout.addView(subjectNumberTextView)
|
||||||
@@ -196,7 +243,7 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
subjectNameTextView.setTextColor(
|
subjectNameTextView.setTextColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.black
|
R.color.white
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -211,17 +258,25 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
subjectPlaceTextView.text = subj.place
|
subjectPlaceTextView.text = subj.place
|
||||||
if (subj.free) {
|
if (subj.free) {
|
||||||
// underline
|
// underline
|
||||||
subjectPlaceTextView.setTypeface(null, Typeface.ITALIC)
|
subjectPlaceTextView.setTypeface(customFont, Typeface.ITALIC)
|
||||||
}
|
}
|
||||||
subjectPlaceTextView.textSize = 22f
|
subjectPlaceTextView.textSize = 22f
|
||||||
subjectPlaceTextView.gravity = Gravity.CENTER_VERTICAL
|
subjectPlaceTextView.gravity = Gravity.CENTER_VERTICAL
|
||||||
subjectPlaceTextView.setTextColor(
|
subjectPlaceTextView.setTextColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.black
|
R.color.white
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (subj.free) {
|
||||||
|
subjectPlaceTextView.layoutParams =
|
||||||
|
LinearLayout.LayoutParams(
|
||||||
|
220,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
if (day.subjects[0].substitute != "2") {
|
if (day.subjects[0].substitute != "2") {
|
||||||
subjectLayout.addView(subjectPlaceTextView)
|
subjectLayout.addView(subjectPlaceTextView)
|
||||||
}
|
}
|
||||||
@@ -242,12 +297,12 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
subjectTimeTextView.typeface = customFont
|
subjectTimeTextView.typeface = customFont
|
||||||
subjectTimeTextView.text = subjectTimeString
|
subjectTimeTextView.text = subjectTimeString
|
||||||
subjectTimeTextView.textSize = 20f
|
subjectTimeTextView.textSize = 20f
|
||||||
subjectTimeTextView.setPadding(10, 10, 20, 10)
|
subjectTimeTextView.setPadding(10, 0, 20, 0)
|
||||||
subjectTimeTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
subjectTimeTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
||||||
subjectTimeTextView.setTextColor(
|
subjectTimeTextView.setTextColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.black
|
R.color.white
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -255,30 +310,26 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
subjectTeacherTextView.text = subj.teacher
|
subjectTeacherTextView.text = subj.teacher
|
||||||
subjectTeacherTextView.typeface = customFont
|
subjectTeacherTextView.typeface = customFont
|
||||||
subjectTeacherTextView.textSize = 15f
|
subjectTeacherTextView.textSize = 15f
|
||||||
subjectTeacherTextView.setPadding(10, 10, 20, 10)
|
subjectTeacherTextView.setPadding(10, 0, 20, 10)
|
||||||
subjectTeacherTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
subjectTeacherTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
||||||
subjectTeacherTextView.setTextColor(
|
subjectTeacherTextView.setTextColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.black
|
R.color.white
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
timeTeacherLayout.addView(subjectTimeTextView)
|
timeTeacherLayout.addView(subjectTimeTextView)
|
||||||
if (subj.name != "Volno") {
|
if (subj.name != "Volno") {
|
||||||
|
subjectTimeTextView.setPadding(10, 10, 20, 0)
|
||||||
timeTeacherLayout.addView(subjectTeacherTextView)
|
timeTeacherLayout.addView(subjectTeacherTextView)
|
||||||
}
|
}
|
||||||
|
timeTeacherLayout.setPadding(0, 0, 10, 0)
|
||||||
|
|
||||||
if (day.subjects[0].substitute != "2") {
|
if (day.subjects[0].substitute != "2") {
|
||||||
subjectLayout.addView(timeTeacherLayout)
|
subjectLayout.addView(timeTeacherLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
val subjectSeparator = Space(requireContext())
|
|
||||||
subjectSeparator.layoutParams = LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
|
||||||
resources.getDimensionPixelSize(R.dimen.cal_week_separator_height) // Specify separator height in resources
|
|
||||||
)
|
|
||||||
|
|
||||||
// drawables
|
// drawables
|
||||||
val substituteDrawable = GradientDrawable()
|
val substituteDrawable = GradientDrawable()
|
||||||
substituteDrawable.shape = GradientDrawable.RECTANGLE
|
substituteDrawable.shape = GradientDrawable.RECTANGLE
|
||||||
@@ -333,20 +384,54 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
)
|
)
|
||||||
subjectLayoutParams.setMargins(20, 0, 20, 0)
|
subjectLayoutParams.setMargins(20, 0, 20, 0)
|
||||||
subjectLayout.layoutParams = subjectLayoutParams
|
subjectLayout.layoutParams = subjectLayoutParams
|
||||||
|
|
||||||
|
if (prevSubj.name != subj.name && i != 0) {
|
||||||
|
val subjectSeparator = Space(requireContext())
|
||||||
|
subjectSeparator.layoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
resources.getDimensionPixelSize(R.dimen.cal_week_separator_height) // Specify separator height in resources
|
||||||
|
)
|
||||||
|
|
||||||
|
dayLayout.addView(subjectSeparator)
|
||||||
|
} else if (i != 0) {
|
||||||
|
val subjectSeparator = ImageView(requireContext())
|
||||||
|
subjectSeparator.setImageResource(R.drawable.squiggly_line_100x100)
|
||||||
|
subjectSeparator.layoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
Util.pixelsToDp(20, resources)
|
||||||
|
)
|
||||||
|
|
||||||
|
dayLayout.addView(subjectSeparator)
|
||||||
|
}
|
||||||
|
|
||||||
dayLayout.addView(subjectLayout)
|
dayLayout.addView(subjectLayout)
|
||||||
dayLayout.addView(subjectSeparator)
|
|
||||||
|
prevSubj = subj
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val subjectSeparator = Space(requireContext())
|
||||||
|
subjectSeparator.layoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
resources.getDimensionPixelSize(R.dimen.cal_week_separator_height) // Specify separator height in resources
|
||||||
|
)
|
||||||
|
|
||||||
|
dayLayout.addView(subjectSeparator)
|
||||||
|
|
||||||
val dayEndTextView = TextView(requireContext())
|
val dayEndTextView = TextView(requireContext())
|
||||||
val endTime = day.subjects[day.subjects.size - 1].end
|
val endTime = day.subjects[day.subjects.size - 1].end
|
||||||
val dayEndString = "Den končí v $endTime"
|
Vars.dayEndString = "Den končí v $endTime"
|
||||||
dayEndTextView.text = dayEndString
|
dayEndTextView.text = Vars.dayEndString
|
||||||
dayEndTextView.typeface = customFont
|
dayEndTextView.typeface = customFont
|
||||||
dayEndTextView.textSize = 20f
|
dayEndTextView.textSize = 20f
|
||||||
dayEndTextView.setPadding(0, 30, 0, 30)
|
dayEndTextView.setPadding(0, 30, 0, 30)
|
||||||
dayEndTextView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
dayEndTextView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||||
dayEndTextView.gravity = Gravity.CENTER
|
dayEndTextView.gravity = Gravity.CENTER
|
||||||
dayEndTextView.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
dayEndTextView.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.white
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val dayEndDrawable = GradientDrawable()
|
val dayEndDrawable = GradientDrawable()
|
||||||
dayEndDrawable.shape = GradientDrawable.RECTANGLE
|
dayEndDrawable.shape = GradientDrawable.RECTANGLE
|
||||||
@@ -354,7 +439,14 @@ class DayFragment(private val position: Int) : Fragment(R.layout.fragment_day) {
|
|||||||
dayEndDrawable.setColor(
|
dayEndDrawable.setColor(
|
||||||
ContextCompat.getColor(
|
ContextCompat.getColor(
|
||||||
requireContext(),
|
requireContext(),
|
||||||
R.color.cal_week_bg
|
R.color.primary_transparent_bg
|
||||||
|
)
|
||||||
|
)
|
||||||
|
dayEndDrawable.setStroke(
|
||||||
|
10,
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.primary
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
dayEndTextView.background = dayEndDrawable
|
dayEndTextView.background = dayEndDrawable
|
||||||
|
|||||||
@@ -6,32 +6,6 @@ import android.view.LayoutInflater
|
|||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
|
|
||||||
class Dialogs {
|
class Dialogs {
|
||||||
class SignOut(context: Context) : AlertDialog(context) {
|
|
||||||
init {
|
|
||||||
// Initialize your dialog properties
|
|
||||||
setTitle("Opravdu se chcete odhlásit a ukončit aplikaci?")
|
|
||||||
//setMessage("Uložené přihlašovací údaje budou vymazány.")
|
|
||||||
setCancelable(true) // Set whether the dialog can be canceled by tapping outside
|
|
||||||
|
|
||||||
// Set positive button (e.g., "OK" button)
|
|
||||||
setButton(
|
|
||||||
BUTTON_POSITIVE,
|
|
||||||
"Ano"
|
|
||||||
) { _, _ ->
|
|
||||||
Account.clearAccountFile()
|
|
||||||
MainActivity.quit(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set negative button (e.g., "Cancel" button)
|
|
||||||
setButton(
|
|
||||||
BUTTON_NEGATIVE,
|
|
||||||
"Ne"
|
|
||||||
) { _, _ ->
|
|
||||||
dismiss()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class LanguageChange(context: Context) : AlertDialog(context) {
|
class LanguageChange(context: Context) : AlertDialog(context) {
|
||||||
init {
|
init {
|
||||||
// Initialize your dialog properties
|
// Initialize your dialog properties
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ package com.odweta.solen
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
import android.widget.TextView
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
@@ -24,7 +26,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
private var toastShown: Boolean = false
|
private var toastShown: Boolean = false
|
||||||
private var toast2Shown: Boolean = false
|
private var toast2Shown: Boolean = false
|
||||||
private var done: Boolean = false
|
private var done: Boolean = false
|
||||||
private lateinit var toolbar: androidx.appcompat.widget.Toolbar
|
private lateinit var toolbar: TextView
|
||||||
private var role: String = " - Student"
|
private var role: String = " - Student"
|
||||||
private lateinit var navbar: BottomNavigationView
|
private lateinit var navbar: BottomNavigationView
|
||||||
|
|
||||||
@@ -110,7 +112,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
} else if (!Vars.internetAvail) {
|
} else if (!Vars.internetAvail) {
|
||||||
Vars.internetAvail = Util.internetAvail(applicationContext)
|
Vars.internetAvail = Util.internetAvail(applicationContext)
|
||||||
supportActionBar?.title = "Bez připojení k internetu."
|
toolbar.text = "Bez připojení k internetu."
|
||||||
} else {
|
} else {
|
||||||
Vars.internetAvail = Util.internetAvail(applicationContext)
|
Vars.internetAvail = Util.internetAvail(applicationContext)
|
||||||
}
|
}
|
||||||
@@ -123,13 +125,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
done = false
|
done = false
|
||||||
while (!done) {
|
while (!done) {
|
||||||
supportActionBar?.title = "Načítání nových dat"
|
toolbar.text = "Načítání nových dat"
|
||||||
delay(300)
|
delay(300)
|
||||||
supportActionBar?.title = "Načítání nových dat."
|
toolbar.text = "Načítání nových dat."
|
||||||
delay(300)
|
delay(300)
|
||||||
supportActionBar?.title = "Načítání nových dat.."
|
toolbar.text = "Načítání nových dat.."
|
||||||
delay(300)
|
delay(300)
|
||||||
supportActionBar?.title = "Načítání nových dat..."
|
toolbar.text = "Načítání nových dat..."
|
||||||
delay(300)
|
delay(300)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +141,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
" - Student"
|
" - Student"
|
||||||
}
|
}
|
||||||
|
|
||||||
supportActionBar?.title =
|
toolbar.text =
|
||||||
JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("fullName") +
|
JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("fullName") +
|
||||||
role
|
role
|
||||||
}
|
}
|
||||||
@@ -191,9 +193,13 @@ class MainActivity : AppCompatActivity() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
// check if the file is available offline, if yes, load the data and don't connect to the internet
|
// check if the file is available offline,
|
||||||
|
// if yes, load the data and don't connect to the internet
|
||||||
Vars.internetAvail = Util.internetAvail(applicationContext)
|
Vars.internetAvail = Util.internetAvail(applicationContext)
|
||||||
Vars.timeTableAvailOffline = Util.fileExists(Vars.timeTableFilePath) && !Util.fileIsEmpty(Vars.timeTableFilePath)
|
Vars.timeTableAvailOffline =
|
||||||
|
Util.fileExists(Vars.timeTableFilePath) && !Util.fileIsEmpty(Vars.timeTableFilePath)
|
||||||
|
Vars.marksAvailOffline =
|
||||||
|
Util.fileExists(Vars.marksFilePath) && !Util.fileIsEmpty(Vars.marksFilePath)
|
||||||
|
|
||||||
if (toastShown && Vars.internetAvail && !toast2Shown) {
|
if (toastShown && Vars.internetAvail && !toast2Shown) {
|
||||||
toast2Shown = true
|
toast2Shown = true
|
||||||
@@ -220,6 +226,20 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// parse the data
|
// parse the data
|
||||||
week = Parsing.parseTimeTableJSON(timeTableJSON)
|
week = Parsing.parseTimeTableJSON(timeTableJSON)
|
||||||
|
|
||||||
|
// fetch and parse marks
|
||||||
|
lifecycleScope.launch {
|
||||||
|
Vars.marksJSON = """{"message": "Zatím žádné známky, zkuste aktualizovat data."}"""
|
||||||
|
|
||||||
|
Vars.marksJSON = Network.getMarksJSON()
|
||||||
|
|
||||||
|
//Log.d("MARKS_JSON", JSONObject(Vars.marksJSON).getJSONArray("subjects").toString())
|
||||||
|
|
||||||
|
Vars.marksAvailOffline =
|
||||||
|
Util.saveStringToFile(Vars.marksFilePath, Vars.marksJSON)
|
||||||
|
|
||||||
|
Vars.marks = Parsing.parseMarksJSON(Vars.marksJSON)
|
||||||
|
}
|
||||||
|
|
||||||
// continue to launch phase 2
|
// continue to launch phase 2
|
||||||
launchPhase2()
|
launchPhase2()
|
||||||
} else {
|
} else {
|
||||||
@@ -274,6 +294,12 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// load the offline data
|
// load the offline data
|
||||||
val timeTableJSON = Util.fileToString(Vars.timeTableFilePath)
|
val timeTableJSON = Util.fileToString(Vars.timeTableFilePath)
|
||||||
|
|
||||||
|
Vars.marksJSON = Util.fileToString(Vars.marksFilePath)
|
||||||
|
if (Vars.marksJSON == "") {
|
||||||
|
Vars.marksJSON =
|
||||||
|
"""{"message": "Zatím žádné známky, zkuste aktualizovat data."}"""
|
||||||
|
}
|
||||||
|
|
||||||
// parse the data
|
// parse the data
|
||||||
if (timeTableJSON != "") {
|
if (timeTableJSON != "") {
|
||||||
// cancel a toast, if any
|
// cancel a toast, if any
|
||||||
@@ -284,6 +310,8 @@ class MainActivity : AppCompatActivity() {
|
|||||||
// parse the data
|
// parse the data
|
||||||
week = Parsing.parseTimeTableJSON(timeTableJSON)
|
week = Parsing.parseTimeTableJSON(timeTableJSON)
|
||||||
|
|
||||||
|
Vars.marks = Parsing.parseMarksJSON(Vars.marksJSON)
|
||||||
|
|
||||||
// continue launching
|
// continue launching
|
||||||
launchPhase2()
|
launchPhase2()
|
||||||
} else {
|
} else {
|
||||||
@@ -311,12 +339,18 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
toolbar = findViewById(R.id.toolbar)
|
toolbar = findViewById(R.id.toolbar)
|
||||||
|
|
||||||
setSupportActionBar(toolbar)
|
if (
|
||||||
|
Util.fileToString(Vars.userDataFilePath) != "" &&
|
||||||
|
JSONObject(Util.fileToString(Vars.userDataFilePath)).has("fullName")
|
||||||
|
) {
|
||||||
|
toolbar.text =
|
||||||
|
JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("fullName") +
|
||||||
|
role
|
||||||
|
} else {
|
||||||
|
toolbar.text = "Přihlašte se, prosím."
|
||||||
|
}
|
||||||
|
|
||||||
supportActionBar?.title =
|
//window.statusBarColor = ContextCompat.getColor(applicationContext, R.color.primary)
|
||||||
JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("fullName") + role
|
|
||||||
|
|
||||||
window.statusBarColor = ContextCompat.getColor(applicationContext, R.color.primary)
|
|
||||||
|
|
||||||
|
|
||||||
navbar = findViewById(R.id.bottomNav)
|
navbar = findViewById(R.id.bottomNav)
|
||||||
|
|||||||
@@ -1,24 +1,281 @@
|
|||||||
package com.odweta.solen
|
package com.odweta.solen
|
||||||
|
|
||||||
import android.app.Dialog
|
import android.graphics.Typeface
|
||||||
|
import android.graphics.drawable.GradientDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.fragment.app.DialogFragment
|
import android.view.Gravity
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.Window
|
import android.widget.FrameLayout
|
||||||
import android.widget.Button
|
import android.widget.HorizontalScrollView
|
||||||
import android.widget.ImageView
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.Space
|
||||||
|
import android.widget.TextView
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
// TODO: MARK DETAILS
|
||||||
|
|
||||||
class MarksFragment : Fragment() {
|
class MarksFragment : Fragment() {
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val view = inflater.inflate(R.layout.activity_marks, container, false)
|
val view = inflater.inflate(R.layout.activity_marks, container, false)
|
||||||
|
|
||||||
|
val root = view.findViewById<LinearLayout>(R.id.root)
|
||||||
|
|
||||||
|
if (Vars.marksAvailOffline && !Util.fileIsEmpty(Vars.marksFilePath)) {
|
||||||
|
Vars.marksJSON = Util.fileToString(Vars.marksFilePath)
|
||||||
|
Vars.marksAvailOffline = Util.saveStringToFile(Vars.marksFilePath, Vars.marksJSON)
|
||||||
|
Vars.marks = Parsing.parseMarksJSON(Vars.marksJSON)
|
||||||
|
} else {
|
||||||
|
lifecycleScope.launch {
|
||||||
|
Vars.marksJSON = Network.getMarksJSON()
|
||||||
|
Vars.marksAvailOffline = Util.saveStringToFile(Vars.marksFilePath, Vars.marksJSON)
|
||||||
|
Vars.marks = Parsing.parseMarksJSON(Vars.marksJSON)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
root.addView(createSpace())
|
||||||
|
for (subject in Vars.marks.keys) {
|
||||||
|
root.addView(Vars.marks[subject]?.let { createMarkView(it) })
|
||||||
|
root.addView(createSpace())
|
||||||
|
}
|
||||||
|
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun createSpace(): Space {
|
||||||
|
val space = Space(requireContext())
|
||||||
|
space.layoutParams = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
resources.getDimensionPixelSize(R.dimen.cal_week_separator_height)
|
||||||
|
)
|
||||||
|
|
||||||
|
return space
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun avg(marks: MutableList<Mark>): String {
|
||||||
|
var sum = 0f
|
||||||
|
var len = 0
|
||||||
|
|
||||||
|
for (mark in marks) {
|
||||||
|
len += 1
|
||||||
|
sum += (mark.grade.toFloat() * mark.weight.toFloat())
|
||||||
|
}
|
||||||
|
|
||||||
|
val weights = mutableListOf<Float>()
|
||||||
|
|
||||||
|
for (mark in marks) {
|
||||||
|
weights.add(mark.weight.toFloat())
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%.2f", (sum / sum(weights))).replace(',', '.')
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sum(nums: List<Float>): Float {
|
||||||
|
var sum = 0f
|
||||||
|
for (num in nums) {
|
||||||
|
sum += num
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getAvgBgColor(avg: String): Int {
|
||||||
|
var color: Int = R.color.pastel_orange_transparent
|
||||||
|
|
||||||
|
if (avg.toFloat() in 1f..<2f) {
|
||||||
|
color = R.color.pastel_green_transparent
|
||||||
|
} else if (avg.toFloat() in 2f..<3f) {
|
||||||
|
color = R.color.pastel_yellow_transparent
|
||||||
|
} else if (avg.toFloat() in 3f..<4f) {
|
||||||
|
color = R.color.pastel_orange_transparent
|
||||||
|
} else if (avg.toFloat() in 4f..5f) {
|
||||||
|
color = R.color.pastel_red_transparent
|
||||||
|
}
|
||||||
|
|
||||||
|
return ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
color
|
||||||
|
)
|
||||||
|
}
|
||||||
|
private fun getAvgStrokeColor(avg: String): Int {
|
||||||
|
var color: Int = R.color.pastel_orange
|
||||||
|
|
||||||
|
if (avg.toFloat() in 1f..<2f) {
|
||||||
|
color = R.color.pastel_green
|
||||||
|
} else if (avg.toFloat() in 2f..<3f) {
|
||||||
|
color = R.color.pastel_yellow
|
||||||
|
} else if (avg.toFloat() in 3f..<4f) {
|
||||||
|
color = R.color.pastel_orange
|
||||||
|
} else if (avg.toFloat() in 4f..5f) {
|
||||||
|
color = R.color.pastel_red
|
||||||
|
}
|
||||||
|
|
||||||
|
return ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
color
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun createMarkView(marks: MutableList<Mark>): LinearLayout {
|
||||||
|
val markRoot = LinearLayout(requireContext())
|
||||||
|
markRoot.orientation = LinearLayout.HORIZONTAL
|
||||||
|
val params = LinearLayout.LayoutParams(
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
|
)
|
||||||
|
params.setMargins(20, 0, 20, 0)
|
||||||
|
params.height = 210
|
||||||
|
markRoot.layoutParams = params
|
||||||
|
|
||||||
|
val customFont = context?.let { ResourcesCompat.getFont(it, R.font.roboto) }
|
||||||
|
|
||||||
|
val markDrawable = GradientDrawable()
|
||||||
|
markDrawable.shape = GradientDrawable.RECTANGLE
|
||||||
|
markDrawable.cornerRadius = resources.getDimension(R.dimen.corner_radius)
|
||||||
|
markDrawable.setColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.primary_transparent_bg
|
||||||
|
)
|
||||||
|
)
|
||||||
|
markDrawable.setStroke(
|
||||||
|
10,
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.primary
|
||||||
|
)
|
||||||
|
)
|
||||||
|
markRoot.background = markDrawable
|
||||||
|
|
||||||
|
val avgDrawable = GradientDrawable()
|
||||||
|
avgDrawable.shape = GradientDrawable.RECTANGLE
|
||||||
|
avgDrawable.cornerRadius = resources.getDimension(R.dimen.corner_radius)
|
||||||
|
avgDrawable.setColor(
|
||||||
|
if (!marks.contains(Mark().none())) {
|
||||||
|
getAvgBgColor(avg(marks))
|
||||||
|
} else {
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.pastel_orange_transparent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
avgDrawable.setStroke(
|
||||||
|
10,
|
||||||
|
if (!marks.contains(Mark().none())) {
|
||||||
|
getAvgStrokeColor(avg(marks))
|
||||||
|
} else {
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.pastel_orange
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
val avgTextView = TextView(requireContext())
|
||||||
|
avgTextView.typeface = customFont
|
||||||
|
|
||||||
|
val text = if (!marks.contains(Mark().none())) {
|
||||||
|
avg(marks)
|
||||||
|
} else {
|
||||||
|
"-"
|
||||||
|
}
|
||||||
|
avgTextView.text = text
|
||||||
|
avgTextView.textSize = 30f
|
||||||
|
avgTextView.setPadding(20, 20, 20, 20)
|
||||||
|
avgTextView.gravity = Gravity.CENTER // Center text vertically
|
||||||
|
avgTextView.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.white
|
||||||
|
)
|
||||||
|
)
|
||||||
|
avgTextView.background = avgDrawable
|
||||||
|
|
||||||
|
val frameLayout = FrameLayout(requireContext())
|
||||||
|
val layoutParams = LinearLayout.LayoutParams(
|
||||||
|
210,
|
||||||
|
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
)
|
||||||
|
frameLayout.layoutParams = layoutParams
|
||||||
|
frameLayout.addView(avgTextView)
|
||||||
|
|
||||||
|
markRoot.addView(frameLayout)
|
||||||
|
|
||||||
|
val nameAndMarksLayout = LinearLayout(requireContext())
|
||||||
|
nameAndMarksLayout.orientation = LinearLayout.VERTICAL
|
||||||
|
nameAndMarksLayout.gravity = Gravity.START
|
||||||
|
|
||||||
|
val subjectTextView = TextView(requireContext())
|
||||||
|
subjectTextView.text = marks[0].subject.uppercase()
|
||||||
|
subjectTextView.setPadding(20, 15, 20, 0)
|
||||||
|
subjectTextView.textSize = 30f
|
||||||
|
subjectTextView.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.white
|
||||||
|
)
|
||||||
|
)
|
||||||
|
subjectTextView.setTypeface(customFont, Typeface.BOLD)
|
||||||
|
|
||||||
|
nameAndMarksLayout.addView(subjectTextView)
|
||||||
|
|
||||||
|
val marksTextView = TextView(requireContext())
|
||||||
|
var markString = ""
|
||||||
|
for ((i, mark) in marks.withIndex()) {
|
||||||
|
markString += mark.grade
|
||||||
|
if (i < marks.size - 1) {
|
||||||
|
markString += ", "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
marksTextView.text = markString
|
||||||
|
marksTextView.setPadding(20, -15, 20, 0)
|
||||||
|
marksTextView.textSize = 23f
|
||||||
|
marksTextView.setTextColor(
|
||||||
|
ContextCompat.getColor(
|
||||||
|
requireContext(),
|
||||||
|
R.color.white
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val marksScrollView = HorizontalScrollView(requireContext())
|
||||||
|
marksScrollView.addView(marksTextView)
|
||||||
|
|
||||||
|
nameAndMarksLayout.addView(marksScrollView)
|
||||||
|
|
||||||
|
markRoot.addView(nameAndMarksLayout)
|
||||||
|
|
||||||
|
return markRoot
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Mark {
|
||||||
|
lateinit var grade: String // markText
|
||||||
|
lateinit var weight: String // weight
|
||||||
|
lateinit var subject: String // subjectId -> parse that
|
||||||
|
lateinit var date: String // markDate
|
||||||
|
lateinit var theme: String // theme
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "mark: ${this.grade} * ${this.weight}, subject: ${this.subject}, description: ${this.theme}, date: ${this.date}"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun none(): Mark {
|
||||||
|
val mark = Mark()
|
||||||
|
mark.subject = "Zatím žádné známky."
|
||||||
|
mark.grade = "0"
|
||||||
|
mark.weight = "0"
|
||||||
|
mark.date = "-"
|
||||||
|
mark.theme = "-"
|
||||||
|
|
||||||
|
return mark
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ class MenuFragment : Fragment() {
|
|||||||
): View? {
|
): View? {
|
||||||
val view = inflater.inflate(R.layout.activity_menu, container, false)
|
val view = inflater.inflate(R.layout.activity_menu, container, false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
addCallbacks(view)
|
addCallbacks(view)
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|||||||
@@ -58,14 +58,40 @@ class Network {
|
|||||||
Vars.userData = getUserDataJSON()
|
Vars.userData = getUserDataJSON()
|
||||||
Util.saveStringToFile(Vars.userDataFilePath, Vars.userData)
|
Util.saveStringToFile(Vars.userDataFilePath, Vars.userData)
|
||||||
Vars.studentId = getStudentId()
|
Vars.studentId = getStudentId()
|
||||||
|
Vars.syid = getSYID()
|
||||||
|
|
||||||
|
//Log.d("SYID", Vars.syid)
|
||||||
|
|
||||||
|
Vars.marksUrl = "${Vars.apiBaseUrl}/v1/students/${Vars.studentId}/marks/list?SemesterId=${Vars.syid}"
|
||||||
|
|
||||||
|
Vars.isAPISetUp = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getSYID(): String {
|
||||||
|
val syidRoot = JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("schoolYearId")
|
||||||
|
val toAdd = JSONObject(Util.fileToString(Vars.userDataFilePath)).getString("studyYear")
|
||||||
|
|
||||||
|
val syidStart = syidRoot[0]
|
||||||
|
var syidNum = syidRoot.slice(1..<syidRoot.length).toInt()
|
||||||
|
|
||||||
|
for (ch in toAdd) {
|
||||||
|
syidNum += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: REMOVE LATER, JUST FOR DEBUG
|
||||||
|
syidNum -= 1
|
||||||
|
|
||||||
|
return syidStart.toString() + syidNum.toString()
|
||||||
|
}
|
||||||
|
|
||||||
private fun getStudentId(): String {
|
private fun getStudentId(): String {
|
||||||
return if (!Parsing.userIsParent()) {
|
return if (!Parsing.userIsParent()) {
|
||||||
JSONObject(Vars.userData).get("personID").toString()
|
JSONObject(Vars.userData).getString("personID")
|
||||||
} else {
|
} else {
|
||||||
JSONObject(Vars.userData).getJSONArray("children").getJSONObject(0).get("id").toString()
|
JSONObject(Vars.userData).getJSONArray("children")
|
||||||
|
.getJSONObject(0)
|
||||||
|
.getString("id")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,5 +137,23 @@ class Network {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun getMarksJSON(): String {
|
||||||
|
return withContext(Dispatchers.IO) {
|
||||||
|
val request = Request.Builder()
|
||||||
|
.url(Vars.marksUrl)
|
||||||
|
.header("Content-Type", "application/x-www-form-urlencoded")
|
||||||
|
.header("Authorization", "Bearer ${Vars.token}")
|
||||||
|
.get()
|
||||||
|
.build()
|
||||||
|
|
||||||
|
try {
|
||||||
|
val resp = Vars.client.newCall(request).execute()
|
||||||
|
resp.body?.string().toString()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
"""{"error": "network"}"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.odweta.solen
|
package com.odweta.solen
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
@@ -236,5 +237,66 @@ class Parsing {
|
|||||||
|
|
||||||
return week
|
return week
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun parseMarksJSON(jsonString: String): MutableMap<String, MutableList<Mark>> {
|
||||||
|
if (!JSONObject(jsonString).has("marks")) {
|
||||||
|
val noMarks = mutableMapOf<String, MutableList<Mark>>()
|
||||||
|
val list = mutableListOf<Mark>()
|
||||||
|
list.add(Mark().none())
|
||||||
|
noMarks["-"] = list
|
||||||
|
|
||||||
|
return noMarks
|
||||||
|
}
|
||||||
|
|
||||||
|
val marks = mutableMapOf<String, MutableList<Mark>>()
|
||||||
|
|
||||||
|
val marksList = mutableListOf<JSONObject>()
|
||||||
|
|
||||||
|
val marksJSONArray = JSONObject(jsonString).getJSONArray("marks")
|
||||||
|
|
||||||
|
val subjectsJSONArray = JSONObject(jsonString).getJSONArray("subjects")
|
||||||
|
val subjectMap = mutableMapOf<String, String>()
|
||||||
|
|
||||||
|
for (i in 0..<subjectsJSONArray.length()) {
|
||||||
|
val subj = subjectsJSONArray.getJSONObject(i)
|
||||||
|
subjectMap[subj.getString("id")] = subj.getString("abbrev")
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i in 0..<marksJSONArray.length()) {
|
||||||
|
marksList.add(marksJSONArray.getJSONObject(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
for (subj in subjectMap.values) {
|
||||||
|
marks[subj] = mutableListOf()
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* class Mark {
|
||||||
|
* lateinit var grade: String // markText
|
||||||
|
* lateinit var weight: String // weight
|
||||||
|
* lateinit var subject: String // subjectId -> parse that
|
||||||
|
* lateinit var date: String // markDate
|
||||||
|
* lateinit var theme: String // theme
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
for (markJSON in marksList) {
|
||||||
|
val mark = Mark()
|
||||||
|
|
||||||
|
mark.grade = markJSON.getString("markText")
|
||||||
|
|
||||||
|
mark.weight = markJSON.getString("weight")
|
||||||
|
|
||||||
|
mark.subject = subjectMap[markJSON.getString("subjectId")].toString()
|
||||||
|
|
||||||
|
mark.date = markJSON.getString("markDate")
|
||||||
|
|
||||||
|
mark.theme = markJSON.getString("theme")
|
||||||
|
|
||||||
|
marks[mark.subject]?.add(mark)
|
||||||
|
}
|
||||||
|
|
||||||
|
return marks
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,7 @@ class SettingsFragment : DialogFragment() {
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setStyle(STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen)
|
setStyle(STYLE_NORMAL, R.style.Theme_Solen)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.odweta.solen
|
package com.odweta.solen
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.NetworkCapabilities
|
import android.net.NetworkCapabilities
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
@@ -109,5 +110,13 @@ class Util {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun pixelsToDp(pixels: Int, resources: Resources): Int {
|
||||||
|
return (pixels * resources.displayMetrics.density).toInt()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dpToPixels(dp: Int, resources: Resources): Int {
|
||||||
|
return (dp / resources.displayMetrics.density).toInt()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.odweta.solen
|
package com.odweta.solen
|
||||||
|
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -8,30 +9,39 @@ class Vars {
|
|||||||
const val accountDataFilePath: String = "account_data.txt"
|
const val accountDataFilePath: String = "account_data.txt"
|
||||||
const val timeTableFilePath: String = "timetable.json"
|
const val timeTableFilePath: String = "timetable.json"
|
||||||
const val userDataFilePath: String = "userdata.json"
|
const val userDataFilePath: String = "userdata.json"
|
||||||
//const val marksFilePath: String = "marks.json"
|
const val marksFilePath: String = "marks.json"
|
||||||
lateinit var fileDir: File
|
var fileDir: File = File("")
|
||||||
var width: Int = 0
|
var width: Int = 0
|
||||||
var height: Int = 0
|
var height: Int = 0
|
||||||
var internetAvail: Boolean = false
|
var internetAvail: Boolean = false
|
||||||
|
|
||||||
var timeTableAvailOffline: Boolean = false
|
var timeTableAvailOffline: Boolean = false
|
||||||
//var marksAvailOffline: Boolean = false
|
var marksAvailOffline: Boolean = false
|
||||||
|
|
||||||
val dayMap = mutableMapOf<Int, Day>()
|
val dayMap = mutableMapOf<Int, Day>()
|
||||||
var days = listOf<Day>()
|
var days = listOf<Day>()
|
||||||
|
|
||||||
lateinit var username: String
|
var marksJSON: String = ""
|
||||||
lateinit var password: String
|
var marks: MutableMap<String, MutableList<Mark>> = mutableMapOf()
|
||||||
|
|
||||||
|
var username: String = ""
|
||||||
|
var password: String = ""
|
||||||
|
|
||||||
val client = OkHttpClient()
|
val client = OkHttpClient()
|
||||||
|
|
||||||
private const val apiBaseUrl = "https://aplikace.skolaonline.cz/solapi/api"
|
var isAPISetUp: Boolean = false
|
||||||
|
|
||||||
|
var selectedDay: Int = 0
|
||||||
|
var dayEndString: String = ""
|
||||||
|
|
||||||
|
const val apiBaseUrl = "https://aplikace.skolaonline.cz/solapi/api"
|
||||||
const val tokenUrl = "$apiBaseUrl/connect/token"
|
const val tokenUrl = "$apiBaseUrl/connect/token"
|
||||||
lateinit var token: String
|
var token: String = ""
|
||||||
const val userDataUrl = "$apiBaseUrl/v1/user"
|
const val userDataUrl = "$apiBaseUrl/v1/user"
|
||||||
lateinit var userData: String
|
var userData: String = ""
|
||||||
lateinit var studentId: String
|
var studentId: String = ""
|
||||||
const val timeTableUrl = "$apiBaseUrl/v1/timeTable"
|
const val timeTableUrl = "$apiBaseUrl/v1/timeTable"
|
||||||
//val marksUrl = "$apiBaseUrl/v1/students/$studentId/marks/list"
|
var syid = "" // school year id
|
||||||
|
var marksUrl = "$apiBaseUrl/v1/students/$studentId/marks/list?SemesterId=$syid"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<corners android:radius="@dimen/corner_radius" />
|
||||||
|
<solid android:color="@color/pastel_orange_transparent" />
|
||||||
|
<stroke android:width="5dp" android:color="@color/pastel_orange" />
|
||||||
|
</shape>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
@@ -42,10 +42,10 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/textView"
|
android:id="@+id/textView"
|
||||||
android:layout_width="299dp"
|
android:layout_width="299dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:layout_marginBottom="300dp"
|
android:layout_marginBottom="300dp"
|
||||||
android:text="Vylepšená verze školního informačního systému ŠkolaOnLine."
|
android:text="Vylepšená verze mobilní aplikace ŠkolaOnLine"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textSize="24sp"
|
android:textSize="24sp"
|
||||||
@@ -54,7 +54,23 @@
|
|||||||
app:layout_constraintHorizontal_bias="0.416"
|
app:layout_constraintHorizontal_bias="0.416"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/imageView2"
|
app:layout_constraintTop_toBottomOf="@+id/imageView2"
|
||||||
app:layout_constraintVertical_bias="0.804" />
|
app:layout_constraintVertical_bias="0.658" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView3"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="144dp"
|
||||||
|
android:layout_marginTop="70dp"
|
||||||
|
android:layout_marginEnd="1dp"
|
||||||
|
android:text="Vývoj:"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toStartOf="@+id/link"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||||
|
app:layout_constraintVertical_bias="0.106" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/link"
|
android:id="@+id/link"
|
||||||
@@ -64,7 +80,6 @@
|
|||||||
android:layout_marginStart="1dp"
|
android:layout_marginStart="1dp"
|
||||||
android:layout_marginTop="70dp"
|
android:layout_marginTop="70dp"
|
||||||
android:layout_marginEnd="139dp"
|
android:layout_marginEnd="139dp"
|
||||||
android:layout_marginBottom="188dp"
|
|
||||||
android:text=" Odweta"
|
android:text=" Odweta"
|
||||||
android:textColor="#FFFFFF"
|
android:textColor="#FFFFFF"
|
||||||
android:textFontWeight="400"
|
android:textFontWeight="400"
|
||||||
@@ -74,24 +89,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@+id/textView3"
|
app:layout_constraintStart_toEndOf="@+id/textView3"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||||
app:layout_constraintVertical_bias="1.0" />
|
app:layout_constraintVertical_bias="0.106" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textView3"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="144dp"
|
|
||||||
android:layout_marginTop="70dp"
|
|
||||||
android:layout_marginEnd="1dp"
|
|
||||||
android:layout_marginBottom="188dp"
|
|
||||||
android:text="Vývoj:"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toStartOf="@+id/link"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
|
||||||
app:layout_constraintVertical_bias="1.0" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView7"
|
android:id="@+id/imageView7"
|
||||||
@@ -123,4 +121,19 @@
|
|||||||
app:layout_constraintStart_toEndOf="@+id/imageView7"
|
app:layout_constraintStart_toEndOf="@+id/imageView7"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/link"
|
app:layout_constraintTop_toBottomOf="@+id/link"
|
||||||
app:layout_constraintVertical_bias="1.0" />
|
app:layout_constraintVertical_bias="1.0" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/textView4"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="40dp"
|
||||||
|
android:fontFamily="monospace"
|
||||||
|
android:text="Přehlednost je podstata."
|
||||||
|
android:textAllCaps="false"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="italic"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/textView"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -12,9 +12,4 @@
|
|||||||
android:id="@+id/dayPager"
|
android:id="@+id/dayPager"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" />
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/fragmentContainer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/Theme.Solen.AppBarOverlay"
|
|
||||||
tools:ignore="MissingConstraints">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:id="@+id/toolbar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?attr/actionBarSize"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:popupTheme="@style/Theme.Solen.PopupOverlay"
|
|
||||||
app:theme="@style/Theme.Solen.AppBarOverlay"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/loadingTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="93dp"
|
|
||||||
android:layout_marginTop="332dp"
|
|
||||||
android:layout_marginEnd="94dp"
|
|
||||||
android:layout_marginBottom="332dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="Načítání..."
|
|
||||||
android:textSize="50sp"
|
|
||||||
android:fontFamily="@font/roboto"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
tools:ignore="HardcodedText" />
|
|
||||||
|
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
|
||||||
android:id="@+id/dayPager"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/fragmentContainer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" />
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@@ -8,46 +8,42 @@
|
|||||||
tools:context=".MainActivity">
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appBarLayout2"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fontFamily="@font/roboto_src"
|
android:id="@+id/toolbarFrame"
|
||||||
android:theme="@style/Theme.Solen.AppBarOverlay"
|
android:background="@color/black">
|
||||||
app:popupTheme="@style/Theme.Solen.PopupOverlay">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<TextView
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/colorPrimary"
|
android:background="@drawable/button_background"
|
||||||
app:subtitle=""
|
android:gravity="center"
|
||||||
app:title="" />
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_marginHorizontal="5dp"
|
||||||
<androidx.viewpager2.widget.ViewPager2
|
android:padding="10dp"
|
||||||
android:id="@+id/dayPager"
|
android:textColor="@color/white"
|
||||||
android:layout_width="match_parent"
|
android:textSize="25dp" />
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
</androidx.viewpager2.widget.ViewPager2>
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/fragmentContainer"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/fragmentContainer"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:background="@color/black"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bottomNav"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="1.0"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/toolbarFrame"
|
||||||
|
app:layout_constraintVertical_bias="0.0" />
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
android:id="@+id/bottomNav"
|
android:id="@+id/bottomNav"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="wrap_content"
|
||||||
android:scrollIndicators="left"
|
app:layout_constraintTop_toBottomOf="@+id/fragmentContainer"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/appBarLayout2"
|
app:menu="@menu/menu_navbar" />
|
||||||
app:layout_constraintVertical_bias="1.0"
|
|
||||||
app:menu="@menu/menu_navbar"
|
|
||||||
tools:layout_editor_absoluteX="0dp" />
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -6,21 +6,26 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/black">
|
android:background="@color/black">
|
||||||
|
|
||||||
<TextView
|
<ScrollView
|
||||||
android:id="@+id/textView2"
|
android:id="@+id/scroll"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginStart="146dp"
|
|
||||||
android:layout_marginTop="262dp"
|
|
||||||
android:layout_marginEnd="182dp"
|
|
||||||
android:layout_marginBottom="442dp"
|
|
||||||
android:text="ZNAMKY"
|
|
||||||
android:textColor="#FFFFFF"
|
|
||||||
android:textSize="20sp"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.0"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
app:layout_constraintVertical_bias="0.0" />
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/root"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginStart="1dp"
|
||||||
|
android:layout_marginTop="1dp"
|
||||||
|
android:layout_marginEnd="1dp"
|
||||||
|
android:layout_marginBottom="1dp"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -9,52 +9,63 @@
|
|||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_button_settings"
|
android:id="@+id/menu_button_settings"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="190dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:layout_marginTop="200dp"
|
android:layout_marginTop="200dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp"
|
||||||
android:text="@string/settings"
|
android:text="@string/settings"
|
||||||
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/menu_button_sign_out"
|
app:layout_constraintBottom_toTopOf="@+id/menu_button_sign_out"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.497"
|
app:layout_constraintHorizontal_bias="0.497"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:background="@drawable/button_background"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_button_sign_out"
|
android:id="@+id/menu_button_sign_out"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="190dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp"
|
||||||
android:text="@string/sign_out"
|
android:text="@string/sign_out"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:cornerRadius="@dimen/corner_radius"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/menu_button_sign_in"
|
app:layout_constraintBottom_toTopOf="@+id/menu_button_sign_in"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.498"
|
app:layout_constraintHorizontal_bias="0.498"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/menu_button_settings" />
|
app:layout_constraintTop_toBottomOf="@+id/menu_button_settings"
|
||||||
|
android:background="@drawable/button_background" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_button_sign_in"
|
android:id="@+id/menu_button_sign_in"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="190dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:layout_marginBottom="50dp"
|
android:layout_marginBottom="50dp"
|
||||||
android:text="@string/sign_in"
|
android:text="@string/sign_in"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:cornerRadius="@dimen/corner_radius"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/menu_button_about"
|
app:layout_constraintBottom_toTopOf="@+id/menu_button_about"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintHorizontal_bias="0.497"
|
app:layout_constraintHorizontal_bias="0.497"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/menu_button_sign_out" />
|
app:layout_constraintTop_toBottomOf="@+id/menu_button_sign_out"
|
||||||
|
android:background="@drawable/button_background" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/menu_button_about"
|
android:id="@+id/menu_button_about"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="190dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="80dp"
|
||||||
android:layout_marginStart="158dp"
|
android:layout_marginStart="158dp"
|
||||||
android:layout_marginEnd="159dp"
|
android:layout_marginEnd="159dp"
|
||||||
android:layout_marginBottom="200dp"
|
android:layout_marginBottom="200dp"
|
||||||
android:text="@string/about_app"
|
android:text="@string/about_app"
|
||||||
|
android:textSize="20sp"
|
||||||
|
app:cornerRadius="@dimen/corner_radius"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/menu_button_sign_in" />
|
app:layout_constraintTop_toBottomOf="@+id/menu_button_sign_in"
|
||||||
|
android:background="@drawable/button_background" />
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -49,7 +49,11 @@
|
|||||||
android:id="@+id/setting_language"
|
android:id="@+id/setting_language"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingTop="10dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:paddingBottom="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/settings_language_text"
|
android:id="@+id/settings_language_text"
|
||||||
@@ -57,6 +61,10 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/lang_change"
|
android:text="@string/lang_change"
|
||||||
|
android:textColor="#FFFFFF"
|
||||||
|
android:textColorHighlight="#FFFFFF"
|
||||||
|
android:textColorHint="#FFFFFF"
|
||||||
|
android:textColorLink="#FFFFFF"
|
||||||
android:textSize="20sp" />
|
android:textSize="20sp" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -64,7 +72,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/lang_choose" />
|
android:text="@string/lang_choose"
|
||||||
|
android:background="@drawable/button_background" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -9,20 +9,19 @@
|
|||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="457dp"
|
android:layout_width="457dp"
|
||||||
android:layout_height="307dp"
|
android:layout_height="307dp"
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:layout_marginBottom="17dp"
|
android:layout_marginBottom="17dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/usernameField"
|
app:layout_constraintBottom_toTopOf="@+id/usernameField"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.528"
|
||||||
app:srcCompat="@drawable/solen" />
|
app:srcCompat="@drawable/solen" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/usernameField"
|
android:id="@+id/usernameField"
|
||||||
android:layout_width="237dp"
|
android:layout_width="240dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginTop="292dp"
|
android:layout_marginTop="292dp"
|
||||||
android:layout_marginBottom="52dp"
|
|
||||||
android:background="@color/primary"
|
android:background="@color/primary"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Uživatelské jméno"
|
android:hint="Uživatelské jméno"
|
||||||
@@ -30,19 +29,21 @@
|
|||||||
android:paddingHorizontal="20dp"
|
android:paddingHorizontal="20dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textColorHighlight="@color/white"
|
android:textColorHighlight="@color/white"
|
||||||
android:textColorHint="@color/white"
|
android:textColorHint="#C8FFFFFF"
|
||||||
android:textColorLink="@color/white"
|
android:textColorLink="@color/white"
|
||||||
|
android:theme="@style/sign_in_field"
|
||||||
app:circularflow_radiusInDP="20dp"
|
app:circularflow_radiusInDP="20dp"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/passwordField"
|
app:layout_constraintBottom_toTopOf="@+id/passwordField"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="0.85" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/passwordField"
|
android:id="@+id/passwordField"
|
||||||
android:layout_width="237dp"
|
android:layout_width="240dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_marginBottom="288dp"
|
android:layout_marginBottom="224dp"
|
||||||
android:background="@color/primary"
|
android:background="@color/primary"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:hint="Heslo"
|
android:hint="Heslo"
|
||||||
@@ -50,8 +51,9 @@
|
|||||||
android:paddingHorizontal="20dp"
|
android:paddingHorizontal="20dp"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textColorHighlight="@color/white"
|
android:textColorHighlight="@color/white"
|
||||||
android:textColorHint="@color/white"
|
android:textColorHint="#C8FFFFFF"
|
||||||
android:textColorLink="@color/white"
|
android:textColorLink="@color/white"
|
||||||
|
android:theme="@style/sign_in_field"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
@@ -66,6 +68,7 @@
|
|||||||
android:layout_marginBottom="88dp"
|
android:layout_marginBottom="88dp"
|
||||||
android:text="Přihlásit se"
|
android:text="Přihlásit se"
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
app:cornerRadius="@dimen/corner_radius"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 292 B |
@@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="primary">#FFED7D31</color>
|
<color name="old_primary">#FFED7D31</color>
|
||||||
|
<color name="primary">#FFFF9933</color>
|
||||||
<color name="secondary">#FF000000</color>
|
<color name="secondary">#FF000000</color>
|
||||||
|
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
@@ -8,9 +9,28 @@
|
|||||||
<color name="red">#FFFF0000</color>
|
<color name="red">#FFFF0000</color>
|
||||||
<color name="gray_69">#FF696969</color>
|
<color name="gray_69">#FF696969</color>
|
||||||
|
|
||||||
|
<color name="pastel_red">#FFFF6666</color>
|
||||||
|
<color name="pastel_green">#FF00CC99</color>
|
||||||
|
<color name="pastel_blue">#FF6699CC</color>
|
||||||
|
<color name="pastel_orange">#FFFF9933</color>
|
||||||
|
<color name="pastel_yellow">#FFFFCC33</color>
|
||||||
|
|
||||||
|
<color name="pastel_red_transparent">#50FF6666</color>
|
||||||
|
<color name="pastel_green_transparent">#5000CC99</color>
|
||||||
|
<color name="pastel_blue_transparent">#506699CC</color>
|
||||||
|
<color name="pastel_orange_transparent">#50FF9933</color>
|
||||||
|
<color name="pastel_yellow_transparent">#50FFCC33</color>
|
||||||
|
|
||||||
<color name="cal_week_bg">#FF696969</color>
|
<color name="cal_week_bg">#FF696969</color>
|
||||||
<color name="cal_week_subject">#FFF1F1F1</color>
|
<color name="cal_week_subject">#FFF1F1F1</color>
|
||||||
<color name="cal_week_substitute">#FD411E</color>
|
<color name="cal_week_substitute">#FFFF6666</color>
|
||||||
<color name="cal_week_event">#FFFDAA22</color>
|
<color name="cal_week_substitute_transparent_bg">#50FF6666</color>
|
||||||
<color name="cal_week_free">#FFAAFF66</color>
|
<!--<color name="cal_week_event">#FFFDAA22</color>
|
||||||
|
<color name="cal_week_event_transparent_bg">#50FDAA22</color>-->
|
||||||
|
<color name="cal_week_event">#FF6699CC</color>
|
||||||
|
<color name="cal_week_event_transparent_bg">#506699CC</color>
|
||||||
|
<color name="cal_week_free">#FF00CC99</color>
|
||||||
|
<color name="cal_week_free_transparent_bg">#5000CC99</color>
|
||||||
|
|
||||||
|
<color name="primary_transparent_bg">#50ED7D31</color>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -70,4 +70,9 @@
|
|||||||
<item name="android:linksClickable">true</item>
|
<item name="android:linksClickable">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="sign_in_field">
|
||||||
|
<item name="android:strokeColor">@color/white</item>
|
||||||
|
<item name="android:strokeWidth">5</item>
|
||||||
|
<item name="cornerRadius">@dimen/corner_radius</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user