6 Commits
Author SHA1 Message Date
Odweta 59eab71cc4 made deploy script 2024-12-18 14:10:36 +01:00
Odweta eb289db339 gitignore 2024-12-18 14:09:31 +01:00
Odweta 5b0f016add gitignore update 2024-12-18 11:41:15 +01:00
Odweta f8b05884d3 made new release 2.2.2 (207) 2024-12-18 11:31:59 +01:00
Odweta 1344d57685 gitignore and update fastlane 2024-12-18 11:03:43 +01:00
Odweta cb57affc10 lecture notes now work and also added some cosmetic fixes 2024-12-18 10:00:53 +01:00
17 changed files with 134 additions and 88 deletions
+1
View File
@@ -13,3 +13,4 @@
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties local.properties
mobile/app/build
+2 -2
View File
@@ -1,3 +1,3 @@
![solon-logo](./solon_logo.png) ![solon-logo](solon_logo.png)
# Zorientujte se rychleji v této odlehčené verzi Školy OnLine # Zorientujte se rychleji v této odlehčené verzi Školy OnLine
# Odkaz na stažení aplikace pro Android [zde](https://gitlab.com/Odweta/solon/-/raw/master/release/com.odweta.solon_2.2.1.apk?ref_type=heads&inline=false) (verze 2.2.1) # Odkaz na stažení aplikace pro Android [zde](https://gitlab.com/Odweta/solon/-/releases/2.2.2/downloads/app-release.apk) (verze 2.2.2)
Executable
+58
View File
@@ -0,0 +1,58 @@
#!/bin/bash
echo -n "version number: "
read ver
echo -n "glpat: "
read glpat
cd ./mobile
# build
./gradlew assembleRelease
# sign
~/Android/Sdk/build-tools/35.0.0/apksigner sign --alignment-preserved --ks ~/Documents/android-keystore.jks app/build/outputs/apk/release/com.odweta.solon_$ver.apk
# add, commit, push
git add ..
git commit -m "made new release $ver"
git push
# create the tag
echo "\n[creating tag v$ver]"
data_str='{ "tag_name": "'$ver'", "ref": "HEAD", "message": "Tagging release v'$ver'" }'
curl --request POST \
--header "PRIVATE-TOKEN: $glpat" \
--header "Content-Type: application/json" \
--data "$data_str" \
"https://gitlab.com/api/v4/projects/47146187/repository/tags"
# make a release
echo "\n[publishing release $ver]"
data_str='{ "name": "v'$ver'", "tag_name": "'$ver'", "ref": "HEAD" }'
curl --request POST \
--header "PRIVATE-TOKEN: $glpat" \
--header 'Content-Type: application/json' \
--data "$data_str" \
"https://gitlab.com/api/v4/projects/47146187/releases"
# attach a file
echo "\n[attaching the release apk]"
asset_url="https://gitlab.com/-/project/47146187"$(curl --request POST \
--header "PRIVATE-TOKEN: $glpat" \
--form "file=@app/build/outputs/apk/release/com.odweta.solon_$ver.apk" \
"https://gitlab.com/api/v4/projects/47146187/uploads" | jq .url -r)
# add the file as a stable release asset
echo "\n[creating release asset]"
curl --request POST \
--header "PRIVATE-TOKEN: $glpat" \
--data name="app-release.apk" \
--data url="$asset_url" \
--data filepath="/app-release.apk" \
--data "assets[links][][link_type]=package" \
"https://gitlab.com/api/v4/projects/47146187/releases/$ver/assets/links"
# cd back
cd -
Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

+11
View File
@@ -14,6 +14,17 @@
<option name="screenX" value="720" /> <option name="screenX" value="720" />
<option name="screenY" value="1280" /> <option name="screenY" value="1280" />
</PersistentDeviceSelectionData> </PersistentDeviceSelectionData>
<PersistentDeviceSelectionData>
<option name="api" value="34" />
<option name="brand" value="OPPO" />
<option name="codename" value="OP573DL1" />
<option name="id" value="OP573DL1" />
<option name="manufacturer" value="OPPO" />
<option name="name" value="CPH2557" />
<option name="screenDensity" value="480" />
<option name="screenX" value="1080" />
<option name="screenY" value="2400" />
</PersistentDeviceSelectionData>
<PersistentDeviceSelectionData> <PersistentDeviceSelectionData>
<option name="api" value="28" /> <option name="api" value="28" />
<option name="brand" value="DOCOMO" /> <option name="brand" value="DOCOMO" />
+2 -2
View File
@@ -12,8 +12,8 @@ android {
applicationId = "com.odweta.solon" applicationId = "com.odweta.solon"
minSdk = 28 minSdk = 28
targetSdk = 34 targetSdk = 34
versionCode = 206 versionCode = 207
versionName = "2.2.1" versionName = "2.2.2"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }
@@ -168,16 +168,16 @@ class LectureNote(
id: Int, id: Int,
note: MutableState<String>, note: MutableState<String>,
type: MutableState<LectureNoteType>, type: MutableState<LectureNoteType>,
number: MutableState<Int>, number: Int,
lectureName: MutableState<String> lectureName: String
) { ) {
var id: Int = 0 var id: Int = 0
var note: MutableState<String> = var note: MutableState<String> =
mutableStateOf("") mutableStateOf("")
var type: MutableState<LectureNoteType> = var type: MutableState<LectureNoteType> =
mutableStateOf(LectureNoteType.Normal) mutableStateOf(LectureNoteType.Normal)
var number: MutableState<Int> = mutableIntStateOf(0) var number: Int = 0
var lectureName: MutableState<String> = mutableStateOf("") var lectureName: String = ""
init { init {
this.id = id this.id = id
@@ -188,7 +188,7 @@ class LectureNote(
} }
} }
var lectureNotes: HashMap<Int, MutableState<LectureNote>> = hashMapOf() var lectureNotes: HashMap<Int, LectureNote> = hashMapOf()
var selectedLecture: Int = 0 var selectedLecture: Int = 0
var selectedDay: Int = 0 var selectedDay: Int = 0
@@ -275,7 +275,7 @@ private fun launchPhase2(ctx: Context) {
dayList.add(day) dayList.add(day)
} }
Util.loadLectureIds() Util.loadLectureNotes()
loaded = true loaded = true
@@ -110,11 +110,12 @@ fun DetailDialog() {
) { ) {
Text( Text(
text = "" + text = "" +
lectureNotes[selectedLecture]?.value?.number?.value.toString() + lectureNotes[selectedLecture]?.number.toString() +
" " + " " +
lectureNotes[selectedLecture]?.value?.lectureName?.value.toString(), lectureNotes[selectedLecture]?.lectureName.toString(),
color = Color.White, color = Color.White,
textAlign = TextAlign.Left textAlign = TextAlign.Left,
modifier = Modifier.padding(top = 10.dp)
) )
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@@ -134,7 +135,7 @@ fun DetailDialog() {
disabledContentColor = Color.White disabledContentColor = Color.White
) )
) { ) {
val type = when (lectureNotes[selectedLecture]?.value?.type?.value) { val type = when (lectureNotes[selectedLecture]?.type?.value) {
LectureNoteType.Normal -> "Normální" LectureNoteType.Normal -> "Normální"
LectureNoteType.Writing -> "Písemný test" LectureNoteType.Writing -> "Písemný test"
LectureNoteType.Speaking -> "Ústní zkoušení" LectureNoteType.Speaking -> "Ústní zkoušení"
@@ -159,8 +160,8 @@ fun DetailDialog() {
enabled = true, enabled = true,
onClick = { onClick = {
isExpanded = false isExpanded = false
lectureNotes[selectedLecture]?.value?.type?.value = lectureNotes[selectedLecture]?.type?.value = LectureNoteType.Normal
LectureNoteType.Normal Util.saveLectureNotes()
}, },
text = { Text("Normální poznámka", color = Color.White) } text = { Text("Normální poznámka", color = Color.White) }
) )
@@ -169,8 +170,8 @@ fun DetailDialog() {
enabled = true, enabled = true,
onClick = { onClick = {
isExpanded = false isExpanded = false
lectureNotes[selectedLecture]?.value?.type?.value = lectureNotes[selectedLecture]?.type?.value = LectureNoteType.Writing
LectureNoteType.Writing Util.saveLectureNotes()
}, },
text = { Text("Písemný test", color = Color.White) } text = { Text("Písemný test", color = Color.White) }
) )
@@ -179,8 +180,8 @@ fun DetailDialog() {
enabled = true, enabled = true,
onClick = { onClick = {
isExpanded = false isExpanded = false
lectureNotes[selectedLecture]?.value?.type?.value = lectureNotes[selectedLecture]?.type?.value = LectureNoteType.Speaking
LectureNoteType.Speaking Util.saveLectureNotes()
}, },
text = { Text("Ústní zkoušení", color = Color.White) } text = { Text("Ústní zkoušení", color = Color.White) }
) )
@@ -189,8 +190,8 @@ fun DetailDialog() {
enabled = true, enabled = true,
onClick = { onClick = {
isExpanded = false isExpanded = false
lectureNotes[selectedLecture]?.value?.type?.value = lectureNotes[selectedLecture]?.type?.value = LectureNoteType.Other
LectureNoteType.Other Util.saveLectureNotes()
}, },
text = { Text("Jiné", color = Color.White) } text = { Text("Jiné", color = Color.White) }
) )
@@ -198,24 +199,13 @@ fun DetailDialog() {
//////////////////////////////////////////////// ////////////////////////////////////////////////
if (lectureNotes[selectedLecture] == null) {
lectureNotes[selectedLecture] = mutableStateOf(
LectureNote(
id = 0,
note = mutableStateOf(""),
type = mutableStateOf(LectureNoteType.Normal),
number = mutableIntStateOf(0),
lectureName = mutableStateOf("N/A")
)
)
}
TextField( TextField(
value = lectureNotes[selectedLecture]?.value?.note?.value ?: "", value = lectureNotes[selectedLecture]?.note?.value ?: "",
onValueChange = { newText: String -> onValueChange = { newText: String ->
lectureNotes[selectedLecture]?.value?.note?.value = newText lectureNotes[selectedLecture]?.note?.value = newText
Util.saveLectureIds() Util.saveLectureNotes()
}, },
singleLine = true,
placeholder = { Text("Sem můžete napsat poznámky k\u00A0této hodině.") }, // &nbsp; placeholder = { Text("Sem můžete napsat poznámky k\u00A0této hodině.") }, // &nbsp;
colors = TextFieldDefaults.textFieldColors( colors = TextFieldDefaults.textFieldColors(
focusedTextColor = Color.White, focusedTextColor = Color.White,
@@ -363,17 +353,7 @@ private fun DayScreen(day: Day) {
) { ) {
for ((subjectIndex, subject) in day.subjects.withIndex()) { for ((subjectIndex, subject) in day.subjects.withIndex()) {
val lectureId = Util.getLectureId(day.date, subjectIndex) val lectureId = Util.getLectureId(day.date, subjectIndex)
if (lectureNotes[lectureId] == null) {
lectureNotes[lectureId] = mutableStateOf(LectureNote(
id = lectureId,
note = mutableStateOf(""),
type = mutableStateOf(LectureNoteType.Normal),
number = mutableIntStateOf(0),
lectureName = mutableStateOf("N/A")
))
}
lectureNotes[lectureId]?.value?.number?.value = subject.number.toInt()
lectureNotes[lectureId]?.value?.lectureName?.value = subject.name
val amoledModifier = if (settings.useAmoledMode.checked.value) { val amoledModifier = if (settings.useAmoledMode.checked.value) {
Modifier Modifier
.width(50.dp) .width(50.dp)
@@ -554,10 +534,9 @@ private fun DayScreen(day: Day) {
}) })
if ( if (
lectureNotes[lectureId] == null || (lectureNotes[lectureId] != null && lectureNotes[lectureId]?.note?.value != "") ||
(lectureNotes[lectureId] != null && lectureNotes[lectureId]?.value?.note?.value != "") || (lectureNotes[lectureId] != null && lectureNotes[lectureId]?.type?.value != LectureNoteType.Normal) &&
(lectureNotes[lectureId] != null && lectureNotes[lectureId]?.value?.type?.value != LectureNoteType.Normal) && (lectureNotes[lectureId] != null && lectureNotes[lectureId]?.type?.value != LectureNoteType.Other)
(lectureNotes[lectureId] != null && lectureNotes[lectureId]?.value?.type?.value != LectureNoteType.Other)
) { ) {
Icon( Icon(
modifier = Modifier.padding(start = 3.dp, top = 1.dp), modifier = Modifier.padding(start = 3.dp, top = 1.dp),
@@ -1,6 +1,5 @@
package com.odweta.solon package com.odweta.solon
import android.app.ActivityManager
import android.content.Context import android.content.Context
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.net.ConnectivityManager import android.net.ConnectivityManager
@@ -8,8 +7,6 @@ import android.net.NetworkCapabilities
import android.os.Build import android.os.Build
import android.util.DisplayMetrics import android.util.DisplayMetrics
import android.view.WindowManager import android.view.WindowManager
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.core.content.pm.PackageInfoCompat import androidx.core.content.pm.PackageInfoCompat
import java.io.File import java.io.File
@@ -17,7 +14,6 @@ import java.io.IOException
import java.nio.charset.Charset import java.nio.charset.Charset
import java.security.MessageDigest import java.security.MessageDigest
import kotlin.math.abs import kotlin.math.abs
import kotlin.math.round
class Util { class Util {
companion object { companion object {
@@ -119,7 +115,7 @@ class Util {
} }
} }
fun isAppInForeground(context: Context, packageName: String): Boolean { /*fun isAppInForeground(context: Context, packageName: String): Boolean {
val activityManager = val activityManager =
context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val runningAppProcesses = activityManager.runningAppProcesses ?: return false val runningAppProcesses = activityManager.runningAppProcesses ?: return false
@@ -132,7 +128,7 @@ class Util {
} }
} }
return false return false
} }*/
fun avg(marks: MutableList<Mark>): String { fun avg(marks: MutableList<Mark>): String {
var sum = 0f var sum = 0f
@@ -230,7 +226,7 @@ class Util {
packageManager.getPackageInfo(packageName, 0) packageManager.getPackageInfo(packageName, 0)
} }
AppVersion( AppVersion(
versionName = packageInfo.versionName, versionName = packageInfo.versionName.toString(),
versionNumber = PackageInfoCompat.getLongVersionCode(packageInfo), versionNumber = PackageInfoCompat.getLongVersionCode(packageInfo),
) )
} catch (e: Exception) { } catch (e: Exception) {
@@ -269,56 +265,57 @@ class Util {
}) })
} }
fun csvToHashMap(filePath: String): HashMap<Int, MutableState<LectureNote>> { private fun csvToLectureNotes() {
val hashMap = HashMap<Int, MutableState<LectureNote>>() val lines = fileToString(lectureNotesFilePath).lines()
val lines = fileToString(filePath).lines()
for (line in lines) { for (line in lines) {
if (line.isBlank()) continue if (line.isBlank()) continue
val parts = line.split(",") val parts = line.split(",")
if (parts.size == 5) { if (parts.size >= 3) {
val id = parts[0].trim().toInt() val id = parts[0].trim().toInt()
val note = parts[1].trim() val type = parts[1].trim().toLectureNoteType()
val type = parts[2].trim().toLectureNoteType() var note = parts[2].trim()
val number = parts[3].trim().toInt() for (part in 3.until(parts.size)) {
val lectureName = parts[4].trim() note += ",${parts[part]}"
}
val lectureNote = LectureNote( lectureNotes[id]?.note = mutableStateOf(note)
id, lectureNotes[id]?.type = mutableStateOf(type)
mutableStateOf(note), }
mutableStateOf(type),
mutableIntStateOf(number),
mutableStateOf(lectureName)
)
hashMap[id] = mutableStateOf(lectureNote)
} }
} }
return hashMap private fun lectureNotesToCsvString(hashMap: HashMap<Int, LectureNote>): String {
}
fun hashMapToCsv(hashMap: HashMap<Int, MutableState<LectureNote>>): String {
var result = "" var result = ""
for ((key, lectureNote) in hashMap) { for ((key, lectureNote) in hashMap) {
result += result +=
"$key," + "$key," +
"${lectureNote.value.note.value}," + "${lectureNote.type.value}," +
"${lectureNote.value.type.value}," + "${lectureNote.note.value}\n"
"${lectureNote.value.number.value}," +
lectureNote.value.lectureName.value +
"\n"
} }
return result return result
} }
fun loadLectureIds() { fun loadLectureNotes() {
lectureNotes = csvToHashMap(lectureNotesFilePath) for (day in days) {
for ((subjectIndex, subject) in day.subjects.withIndex()) {
val id = getLectureId(day.date, subjectIndex)
lectureNotes[id] = LectureNote(
id = id,
type = mutableStateOf(LectureNoteType.Normal),
note = mutableStateOf(""),
number = subject.number.toInt(),
lectureName = subject.name
)
}
} }
fun saveLectureIds() { csvToLectureNotes()
val toSave = hashMapToCsv(lectureNotes) }
fun saveLectureNotes() {
val toSave = lectureNotesToCsvString(lectureNotes)
saveStringToFile(lectureNotesFilePath, toSave) saveStringToFile(lectureNotesFilePath, toSave)
} }
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 15 KiB