visual bugfixes, textsize things, yes
This commit is contained in:
+1
-14
@@ -3,20 +3,7 @@
|
||||
<component name="deploymentTargetDropDown">
|
||||
<value>
|
||||
<entry key="app">
|
||||
<State>
|
||||
<targetSelectedWithDropDown>
|
||||
<Target>
|
||||
<type value="QUICK_BOOT_TARGET" />
|
||||
<deviceKey>
|
||||
<Key>
|
||||
<type value="VIRTUAL_DEVICE_PATH" />
|
||||
<value value="$USER_HOME$/.var/app/com.google.AndroidStudio/config/.android/avd/Pixel_3a_API_34_extension_level_7_x86_64.avd" />
|
||||
</Key>
|
||||
</deviceKey>
|
||||
</Target>
|
||||
</targetSelectedWithDropDown>
|
||||
<timeTargetWasSelectedWithDropDown value="2024-02-21T21:45:22.107764718Z" />
|
||||
</State>
|
||||
<State />
|
||||
</entry>
|
||||
</value>
|
||||
</component>
|
||||
|
||||
@@ -27,6 +27,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import java.time.LocalDate
|
||||
import java.time.LocalTime
|
||||
import android.util.Log
|
||||
import java.time.MonthDay
|
||||
import kotlin.math.floor
|
||||
import kotlin.time.Duration.Companion.days
|
||||
@@ -278,6 +279,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
prevSubj.free = false
|
||||
|
||||
for ((i, subj) in day.subjects.withIndex()) {
|
||||
Log.d("debug", "${subj.name} ${subj.substitute}")
|
||||
val subjectBackground = when (subj.substitute) {
|
||||
"0" -> if (subj.place != "Volno") {
|
||||
R.color.primary_transparent_bg
|
||||
@@ -370,7 +372,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
|
||||
frameLayout.addView(subjectNumberTextView)
|
||||
|
||||
if (day.subjects[0].substitute != "2") {
|
||||
if (subj.substitute != "2") {
|
||||
subjectLayout.addView(frameLayout)
|
||||
}
|
||||
|
||||
@@ -380,7 +382,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
}
|
||||
subjectNameTextView.typeface = customFont
|
||||
subjectNameTextView.textSize = 27f
|
||||
subjectNameTextView.setPadding(60, 35, 20, 35)
|
||||
subjectNameTextView.setPadding(60, 35, 0, 35)
|
||||
subjectNameTextView.textAlignment = View.TEXT_ALIGNMENT_CENTER
|
||||
subjectNameTextView.gravity = Gravity.CENTER_VERTICAL
|
||||
if (subj.name != "Volno") {
|
||||
@@ -394,7 +396,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
)
|
||||
|
||||
if (subj.free) {
|
||||
subjectNameTextView.setPadding(260, 35, 20, 35)
|
||||
subjectNameTextView.setPadding(260, 35, 10, 35)
|
||||
}
|
||||
|
||||
subjectLayout.addView(subjectNameTextView)
|
||||
@@ -403,10 +405,11 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
subjectPlaceTextView.typeface = customFont
|
||||
subjectPlaceTextView.text = subj.place
|
||||
if (subj.free) {
|
||||
// underline
|
||||
// italic
|
||||
subjectPlaceTextView.setTypeface(customFont, Typeface.ITALIC)
|
||||
}
|
||||
subjectPlaceTextView.textSize = 22f
|
||||
subjectPlaceTextView.textSize = 20f
|
||||
subjectPlaceTextView.setAutoSizeTextTypeUniformWithConfiguration(40, 60, 1, 0)
|
||||
subjectPlaceTextView.gravity = Gravity.CENTER_VERTICAL
|
||||
subjectPlaceTextView.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
@@ -418,12 +421,12 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
if (subj.free) {
|
||||
subjectPlaceTextView.layoutParams =
|
||||
LinearLayout.LayoutParams(
|
||||
220,
|
||||
230,
|
||||
LinearLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
}
|
||||
|
||||
if (day.subjects[0].substitute != "2") {
|
||||
if (subj.substitute != "2") {
|
||||
subjectLayout.addView(subjectPlaceTextView)
|
||||
}
|
||||
|
||||
@@ -442,7 +445,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
val subjectTimeString = subj.start + "–" + subj.end
|
||||
subjectTimeTextView.typeface = customFont
|
||||
subjectTimeTextView.text = subjectTimeString
|
||||
subjectTimeTextView.textSize = 20f
|
||||
subjectTimeTextView.textSize = 17f
|
||||
subjectTimeTextView.setPadding(10, 0, 20, 0)
|
||||
subjectTimeTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
||||
subjectTimeTextView.setTextColor(
|
||||
@@ -455,7 +458,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
val subjectTeacherTextView = TextView(requireContext())
|
||||
subjectTeacherTextView.text = subj.teacher
|
||||
subjectTeacherTextView.typeface = customFont
|
||||
subjectTeacherTextView.textSize = 12f
|
||||
subjectTeacherTextView.textSize = 11f
|
||||
subjectTeacherTextView.setPadding(0, 0, 20, 10)
|
||||
subjectTeacherTextView.textAlignment = View.TEXT_ALIGNMENT_TEXT_END
|
||||
subjectTeacherTextView.setTextColor(
|
||||
@@ -472,7 +475,7 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
}
|
||||
timeTeacherLayout.setPadding(0, 0, 10, 0)
|
||||
|
||||
if (day.subjects[0].substitute != "2") {
|
||||
if (subj.substitute != "2") {
|
||||
subjectLayout.addView(timeTeacherLayout)
|
||||
}
|
||||
|
||||
@@ -505,9 +508,9 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
rootLayout.viewTreeObserver.removeOnPreDrawListener(this)
|
||||
|
||||
// Call your function or perform an action here
|
||||
if (day.subjects[0].substitute != "2") {
|
||||
if (subj.substitute != "2") {
|
||||
subjectPlaceTextView.setPadding(
|
||||
400 - frameLayout.width - subjectNameTextView.width,
|
||||
380 - frameLayout.width - subjectNameTextView.width,
|
||||
20,
|
||||
20,
|
||||
20
|
||||
@@ -625,11 +628,9 @@ class DayFragment(private val i: Int) : Fragment() {
|
||||
)
|
||||
dayEndTextView.layoutParams = endParams
|
||||
|
||||
if (day.subjects[0].substitute != "2") {
|
||||
dayLayout.addView(dayEndSeparator)
|
||||
dayLayout.addView(dayEndTextView)
|
||||
dayLayout.addView(dayEndSeparator2)
|
||||
}
|
||||
dayLayout.addView(dayEndSeparator)
|
||||
dayLayout.addView(dayEndTextView)
|
||||
dayLayout.addView(dayEndSeparator2)
|
||||
|
||||
scrollView.addView(dayLayout)
|
||||
|
||||
|
||||
@@ -321,15 +321,17 @@ class MainActivity : AppCompatActivity(), MainActivityListener {
|
||||
|
||||
// Fragment Transition
|
||||
private fun ft(container: Int, frag: Fragment, animIn: Int, animOut: Int) {
|
||||
val ft = supportFragmentManager.beginTransaction()
|
||||
if (Util.isAppInForeground(applicationContext, packageName)) {
|
||||
val ft = supportFragmentManager.beginTransaction()
|
||||
|
||||
ft.setCustomAnimations(
|
||||
animIn,
|
||||
animOut
|
||||
)
|
||||
ft.setCustomAnimations(
|
||||
animIn,
|
||||
animOut
|
||||
)
|
||||
|
||||
ft.replace(container, frag)
|
||||
ft.replace(container, frag)
|
||||
|
||||
ft.commit()
|
||||
ft.commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ class MainFragment : Fragment() {
|
||||
private fun fetchNewData() {
|
||||
lifecycleScope.launch {
|
||||
done = false
|
||||
while (!done) {
|
||||
while (!done || !Util.internetAvail(requireContext())) {
|
||||
toolbar.text = String.format("%s", "Načítání nových dat")
|
||||
delay(300)
|
||||
toolbar.text = String.format("%s", "Načítání nových dat.")
|
||||
|
||||
@@ -148,7 +148,7 @@ class MarkDetailsFragment(private val marks: MutableList<Mark>, private var idx:
|
||||
gradeTV.setTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
||||
|
||||
|
||||
val subjectDesc = makeTV("Předmět:", Typeface.BOLD, Util.getDisplayWidth(requireContext())/3)
|
||||
val subjectDesc = makeTV("Předmět:", Typeface.BOLD, Util.getDisplayWidth(requireContext())/2)
|
||||
val subjectTV = makeTV(Vars.subjectNameMap[marks[idx!!].subject] ?: marks[idx!!].subject, Typeface.NORMAL, 22f)
|
||||
|
||||
val descDesc = makeTV("Popis:", Typeface.BOLD, Util.getDisplayWidth(requireContext())/3)
|
||||
|
||||
@@ -34,7 +34,6 @@ class MarksFragment : Fragment() {
|
||||
|
||||
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 {
|
||||
@@ -156,7 +155,7 @@ class MarksFragment : Fragment() {
|
||||
val subjectTextView = TextView(requireContext())
|
||||
subjectTextView.text = marks[0].subject.uppercase()
|
||||
subjectTextView.setPadding(20, 20, 20, 20)
|
||||
subjectTextView.textSize = 30f
|
||||
subjectTextView.textSize = 26f
|
||||
subjectTextView.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
@@ -183,7 +182,7 @@ class MarksFragment : Fragment() {
|
||||
"-"
|
||||
}
|
||||
avgTextView.text = text
|
||||
avgTextView.textSize = 30f
|
||||
avgTextView.textSize = 26f
|
||||
avgTextView.setPadding(20, 20, 20, 20)
|
||||
avgTextView.gravity = Gravity.CENTER // Center text vertically
|
||||
avgTextView.setTypeface(customFont, Typeface.NORMAL)
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.animation.AnimatorInflater
|
||||
import android.animation.AnimatorListenerAdapter
|
||||
import android.animation.ArgbEvaluator
|
||||
import android.animation.ValueAnimator
|
||||
import android.app.ActivityManager
|
||||
import android.content.Context
|
||||
import android.content.res.ColorStateList
|
||||
import android.content.res.Resources
|
||||
@@ -123,6 +124,19 @@ class Util {
|
||||
}
|
||||
}
|
||||
|
||||
fun isAppInForeground(context: Context, packageName: String): Boolean {
|
||||
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
|
||||
val runningAppProcesses = activityManager.runningAppProcesses ?: return false
|
||||
|
||||
for (processInfo in runningAppProcesses) {
|
||||
if (processInfo.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
|
||||
processInfo.processName == packageName) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun pixelsToDp(pixels: Int, resources: Resources): Int {
|
||||
return (pixels * resources.displayMetrics.density).toInt()
|
||||
}
|
||||
|
||||
@@ -110,30 +110,16 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView"
|
||||
app:layout_constraintVertical_bias="0.3" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView7"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="61dp"
|
||||
android:contentDescription="@string/gitlab_logo"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.303"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:srcCompat="@mipmap/gitlab_logo_foreground" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sourceCode"
|
||||
style="@style/LinkText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="96dp"
|
||||
android:layout_marginBottom="100dp"
|
||||
android:text="@string/source_code"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView7" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/textView" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user