Skip to content

Commit

Permalink
4.13.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Chiu-xaH committed Jan 30, 2025
1 parent 7b608fe commit 5c61c2c
Show file tree
Hide file tree
Showing 36 changed files with 1,254 additions and 436 deletions.
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# HFUT-Schedule(聚在工大)
<div align="center">

[<img src="https://f-droid.org/badge/get-it-on-zh-cn.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/packages/com.hfut.schedule)
[![GitHub](https://img.shields.io/github/v/release/Chiu-xaH/HFUT-Schedule?logo=github&label=GitHub&style=for-the-badge)](https://github.com/Chiu-xaH/HFUT-Schedule/releases/latest)
[![F-Droid](https://img.shields.io/f-droid/v/com.hfut.schedule?logo=fdroid&style=for-the-badge)](https://f-droid.org/packages/com.hfut.schedule)
[![F-Droid](https://img.shields.io/github/v/release/Chiu-xaH/HFUT-Schedule?logo=gitee&label=Gitee&style=for-the-badge)](https://gitee.com/chiu-xah/HFUT-Schedule/releases/tag/Android)

</div>

## 说明:
作为本校23届学生,初到学校时了解到大家常用的可以查看课表、成绩、考试等信息的是若干微信小程序和网页,平台较多较分散,且冷启动加载速度较慢,功能较少,多数接口失效,使用起来感觉不便,恰本人那时刚学安卓开发,为解决痛点,并作为实战项目,本应用就诞生了,面向宣区校内同学(理论上合肥校区也可用)使用,更快的启动速度、更全面的功能、无广告设计
Expand All @@ -16,27 +19,21 @@ height="80">](https://f-droid.org/packages/com.hfut.schedule)
![导图](/img/mindMaster.png)

## 权限:
1.日历(将事项作为日程写入日历)

2.存储(导入导出课程表文件)

3.相机(洗浴扫码)
网络、日历(将聚焦事项作为日程写入日历)、存储(导入导出课程表文件)、相机(洗浴扫码)

## 使用:
### 环境要求
ARM架构,支持64 Bit软件、搭载Android 7.0 (SDK 26)及以上版本的设备,初次使用要接入互联网

### 初次使用
下载好APK安装包后,进行安装,保证接入互联网的环境下,填入学号与信息门户密码,点击登录,等待加载完毕即可使用。(最好留在课表页面等待加载完毕,因为要后台登录3个平台,有两个Toast弹完后即完全登录,友友们能不能稍作等待,登陆这一次以后几十天就不用了...)
从开头三个徽章之一下载好APK后,进行安装,保证接入互联网的环境下,填入学号与信息门户密码,点击登录,等待加载完毕即可使用。(最好留在课表页面等待加载完毕,因为要后台登录3个平台,有两个Toast弹完后即完全登录...)

### 后续使用
完全登陆后获取所需的数据,会自动进行本地缓存,以后可随便断网看课表,登陆一次教务系统有效期只有3小时,另外两个平台(一卡通和智慧社区)有效期有足足几十天,不需要同学们经常登录刷新哈,关于更多细分说明在APP中子功能界面右上角会有说明按钮,点击可查看,有不懂的或者有Bug提交issue或发邮件
完全登陆后会获取所需的数据,自动缓存,以后可随便断网看课表,登陆一次教务系统有效期只有3小时,另外两个平台(一卡通和智慧社区)有效期有几十天,不需要同学们经常登录刷新,关于更多细分说明在APP中子功能界面右上角会有说明按钮,点击可查看

### 软件升级
如有更新,会在首页底栏【选项】显示小红点,点击此Tab,在选项界面会有标红卡片,提示新版本,点击下方请求更新,等待进度条即可

已上架到F-Droid

## [接口文档](markdown/API.md)
供校内学生们方便参考或学习

Expand All @@ -56,20 +53,26 @@ UI设计 Material You (Material Design 3)

[Retrofit](https://github.com/square/retrofit) 网络请求

[Gson](https://github.com/google/gson) JSON处理
[Gson](https://github.com/google/gson) JSON解析

[Haze](https://github.com/chrisbanes/haze) 实时模糊
[Jsoup](https://github.com/jhy/jsoup) XML/HTML解析

[Accompanist](https://github.com/google/accompanist) 透明状态栏
[Zxing](https://github.com/zxing/zxing) 二维码

[Monet](https://github.com/Kyant0/Monet) 莫奈取色(供SDK不支持M3取色平替)
[Haze](https://github.com/chrisbanes/haze) 实时模糊(SDK>=33)

[Dagger](https://github.com/google/dagger) Hilt注入
[Accompanist](https://github.com/google/accompanist) 用做实现透明状态栏

[Glide](https://github.com/bumptech/glide) 图片
[Monet](https://github.com/Kyant0/Monet) 莫奈取色(供SDK<32不支持MY取色平替)

[Dagger](https://github.com/google/dagger) Hilt注入,辅助莫奈取色功能

[Glide](https://github.com/bumptech/glide) 网络图片

[EdDSA Java](https://github.com/str4d/ed25519-java) 加密(供和风天气API使用)

[Konfetti](https://github.com/DanielMartinus/Konfetti) 礼花🎉动画

## [更新日志](markdown/UPDATE.md)

## 统计
Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
applicationId "com.hfut.schedule"
minSdk 26
targetSdk 33
versionCode 156
versionName "4.13.4.1"
versionCode 157
versionName "4.13.4.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
Expand Down Expand Up @@ -145,6 +145,8 @@ dependencies {
//implementation "androidx.biometric:biometric:1.1.0"
//用于和风天气密钥生成的JWT
implementation 'net.i2p.crypto:eddsa:0.3.0'
//礼花
implementation 'nl.dionsegijn:konfetti-compose:2.0.5'
//Fragment
// implementation "androidx.fragment:fragment-ktx:1.8.5"
}
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 156,
"versionName": "4.13.4.1",
"versionCode": 157,
"versionName": "4.13.4.2",
"outputFile": "app-release.apk"
}
],
Expand Down
49 changes: 46 additions & 3 deletions app/src/main/java/com/hfut/schedule/activity/main/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,33 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.Toast
import androidx.compose.animation.core.tween
import androidx.compose.animation.expandVertically
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.animation.shrinkVertically
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.lifecycle.lifecycleScope
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.hfut.schedule.logic.utils.PermissionManager.checkAndRequestStoragePermission
import com.hfut.schedule.logic.utils.SharePrefs
import com.hfut.schedule.logic.utils.SharePrefs.prefs
import com.hfut.schedule.logic.utils.getCelebration
import com.hfut.schedule.ui.activity.home.main.saved.Add
import com.hfut.schedule.ui.activity.home.main.saved.NoNetWork
import com.hfut.schedule.ui.activity.home.main.saved.getNum
import com.hfut.schedule.ui.activity.login.First
//import com.hfut.schedule.ui.activity.login.FirstUI
import com.hfut.schedule.ui.activity.login.LoginUI
import com.hfut.schedule.ui.activity.login.UseAgreementUI
import com.hfut.schedule.ui.utils.NavigateManager
import com.hfut.schedule.ui.utils.NavigateManager.ANIMATION_SPEED
import com.hfut.schedule.ui.utils.components.MyToast
import com.hfut.schedule.ui.utils.components.PartyAnimation
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.async
import kotlinx.coroutines.launch
Expand All @@ -31,11 +48,37 @@ class LoginActivity : BaseActivity() {
val switchUpload = prefs.getBoolean("SWITCHUPLOAD",true )
var value = 0

@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
@Composable
override fun UI() {
if(startAcitivity && intent.getBooleanExtra("nologin",true)) {
NoNetWork(super.networkVm,super.loginVm,super.uiVm)
} else LoginUI(super.loginVm)
val navController = rememberNavController()
val first = if(prefs.getBoolean("canUse",false)) First.HOME.name else First.USE_AGREEMENT.name
NavHost(
navController = navController,
startDestination = first,
enterTransition = {
NavigateManager.fadeAnimation.enter
},
exitTransition = {
NavigateManager.fadeAnimation.exit
}
) {
composable(First.HOME.name) {
// 如果庆祝为true则庆祝
val time = if(getCelebration()) 1L else 0L
PartyAnimation(timeSecond = time) {
if(startAcitivity && intent.getBooleanExtra("nologin",true)) {
NoNetWork(super.networkVm,super.loginVm,super.uiVm)
} else LoginUI(super.loginVm)
}
}
composable(First.USE_AGREEMENT.name) {
PartyAnimation {
UseAgreementUI(navController)
}
}
}

}

//打开方式txt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.hfut.schedule.logic.enums

enum class BottomBarItems {
COURSES,
FOCUS,
SEARCH,
SETTINGS
enum class BottomBarItems(val page : Int) {
COURSES(0),
FOCUS(1),
SEARCH(2),
SETTINGS(3)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.hfut.schedule.logic.enums

enum class CardBarItems {
BILLS,
COUNT,
HOME
enum class CardBarItems(val page : Int) {
BILLS(0),
COUNT(1),
HOME(2)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.hfut.schedule.logic.enums

enum class FixBarItems {
Fix,About
enum class FixBarItems(val page : Int) {
Fix(0),About(1)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.hfut.schedule.logic.enums

enum class GradeBarItems {
GRADE,COUNT
enum class GradeBarItems(val page : Int) {
GRADE(0),COUNT(1)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.hfut.schedule.logic.enums

enum class NewsBarItems {
News,XuanCheng,School
enum class NewsBarItems(val page : Int) {
News(0),XuanCheng(1),School(2)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.hfut.schedule.logic.enums

enum class ShowerBarItems {
HOME,BILLS,FUNCTION
enum class ShowerBarItems(val page : Int) {
HOME(0),BILLS(1),FUNCTION(2)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,42 @@ package com.hfut.schedule.logic.utils
import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
import androidx.datastore.preferences.core.stringSetPreferencesKey
import androidx.datastore.preferences.preferencesDataStore
import com.hfut.schedule.App.MyApplication
import com.hfut.schedule.ui.utils.monet.dataStore
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map

class DataStoreManager {
//构建Preferences DataStore
private val Context.dataStore: DataStore<Preferences> by
preferencesDataStore(name = "DataStore")//文件名称
//创建 DataStore 对象
val dataStore = MyApplication.context.dataStore
object DataStoreManager {
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "DataStore")
private val dataStore = MyApplication.context.dataStore

companion object {
val EXAMPLE_COUNTER = intPreferencesKey("example_counter")
val EXAMPLE_COUNTER_SET = stringSetPreferencesKey("example_counter_set")
private val ANIMATION_TYPE = intPreferencesKey("animation_type")

suspend fun saveAnimationType(type: Int) {
dataStore.edit { preferences ->
preferences[ANIMATION_TYPE] = type
}
}


val animationTypeFlow: Flow<Int> = dataStore.data
.map { preferences ->
preferences[ANIMATION_TYPE] ?: 0
}

/* 用法
val currentAnimationIndex by DataStoreManager.XXX.collectAsState(initial = 默认值)
*/
}




//
//fun main() {
// val dataStore = DataStoreManager().dataStore
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/hfut/schedule/logic/utils/Starter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,11 @@ object Starter {
MyApplication.context.startActivity(it)
}

fun emailMe() {
val it = Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:[email protected]"))
it.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
MyApplication.context.startActivity(it)
}


}
16 changes: 16 additions & 0 deletions app/src/main/java/com/hfut/schedule/logic/utils/getCelebration.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.hfut.schedule.logic.utils

import com.google.gson.Gson
import com.hfut.schedule.App.MyApplication
import com.hfut.schedule.logic.beans.MyAPIResponse
import com.hfut.schedule.logic.utils.SharePrefs.prefs
import com.hfut.schedule.viewmodel.NetWorkViewModel

fun getCelebration() : Boolean {
val json = prefs.getString("my",MyApplication.NullMy)
return try {
Gson().fromJson(json,MyAPIResponse::class.java).SettingsInfo.celebration
} catch (e: Exception) {
false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FilledTonalIconButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
Expand All @@ -51,7 +50,6 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.DialogProperties
import androidx.navigation.NavHostController
import com.hfut.schedule.App.MyApplication
import com.hfut.schedule.R
Expand All @@ -74,14 +72,14 @@ import com.hfut.schedule.ui.activity.home.search.functions.electric.EleUI
import com.hfut.schedule.ui.activity.home.search.functions.loginWeb.loginWebUI

import com.hfut.schedule.ui.activity.home.search.functions.shower.ShowerUI
import com.hfut.schedule.ui.utils.NavigateManager.turnTo
import com.hfut.schedule.ui.utils.NavigateManager.turnToAndClear
import com.hfut.schedule.ui.utils.style.CardForListColor
import com.hfut.schedule.ui.utils.components.DividerText
import com.hfut.schedule.ui.utils.components.DividerTextExpandedWith
import com.hfut.schedule.ui.utils.components.MyCard
import com.hfut.schedule.ui.utils.components.MyToast
import com.hfut.schedule.ui.utils.components.WebDialog
import com.hfut.schedule.ui.utils.style.Round
import com.hfut.schedule.ui.utils.components.WebViewScreen
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -578,13 +576,13 @@ fun HomeScreen(innerPadding : PaddingValues, vm : NetWorkViewModel, navControlle
headlineContent = { Text(text = "账单") },
supportingContent = { Text(text = "按消费先后查看交易记录")},
leadingContent = { Icon(painter = painterResource(id = R.drawable.receipt_long), contentDescription = "") },
modifier = Modifier.clickable { turnToBottomBar(navController,CardBarItems.BILLS.name) }
modifier = Modifier.clickable { turnToAndClear(navController,CardBarItems.BILLS.name) }
)
ListItem(
headlineContent = { Text(text = "统计") },
supportingContent = { Text(text = "按时间段归纳统计消费")},
leadingContent = { Icon(painter = painterResource(id = R.drawable.leaderboard), contentDescription = "") },
modifier = Modifier.clickable { turnToBottomBar(navController,CardBarItems.COUNT.name) }
modifier = Modifier.clickable { turnToAndClear(navController,CardBarItems.COUNT.name) }
)
ListItem(
headlineContent = { Text(text = "充值") },
Expand Down Expand Up @@ -652,16 +650,6 @@ fun HomeScreen(innerPadding : PaddingValues, vm : NetWorkViewModel, navControlle
}
}

fun turnToBottomBar(navController : NavHostController,route : String) {
navController.navigate(route) {
popUpTo(navController.graph.startDestinationId) {
saveState = true
}
launchSingleTop = true
restoreState = true
}
}

@Composable
fun limitRow(vmUI : UIViewModel) {
val limit by remember { mutableStateOf(vmUI.CardValue.value?.autotrans_limite ?: prefs.getString("card_limit","0")) }
Expand Down
Loading

0 comments on commit 5c61c2c

Please sign in to comment.