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