Skip to content

Commit

Permalink
Change SplashScreen icon background
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeMeow1027 committed May 3, 2024
1 parent 8be8968 commit fd87fc5
Show file tree
Hide file tree
Showing 40 changed files with 331 additions and 672 deletions.
10 changes: 10 additions & 0 deletions .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 16 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,22 @@ android {
}

dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation platform('androidx.compose:compose-bom:2024.04.00')
implementation "androidx.compose.ui:ui:1.6.5"
implementation "androidx.compose.ui:ui-tooling-preview:1.6.5"
implementation 'androidx.compose.material3:material3'
implementation platform('androidx.compose:compose-bom:2024.04.00')
implementation 'androidx.activity:activity-compose:1.9.0'
implementation platform('androidx.compose:compose-bom:2024.05.00')
implementation "androidx.compose.ui:ui:1.6.7"
implementation "androidx.compose.ui:ui-tooling-preview:1.6.7"
implementation platform('androidx.compose:compose-bom:2024.05.00')
implementation 'androidx.compose.ui:ui-graphics'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.04.00')
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.5"
androidTestImplementation platform('androidx.compose:compose-bom:2024.04.00')
debugImplementation "androidx.compose.ui:ui-tooling:1.6.5"
debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.5"
androidTestImplementation platform('androidx.compose:compose-bom:2024.05.00')
androidTestImplementation "androidx.compose.ui:ui-test-junit4:1.6.7"
androidTestImplementation platform('androidx.compose:compose-bom:2024.05.00')
debugImplementation "androidx.compose.ui:ui-tooling:1.6.7"
debugImplementation "androidx.compose.ui:ui-test-manifest:1.6.7"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.appcompat:appcompat-resources:1.6.1"

Expand All @@ -82,10 +81,10 @@ dependencies {
runtimeOnly 'androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0'

// https://mvnrepository.com/artifact/androidx.fragment/fragment-ktx
runtimeOnly 'androidx.fragment:fragment-ktx:1.7.0-rc01'
runtimeOnly 'androidx.fragment:fragment-ktx:1.7.0'

// https://mvnrepository.com/artifact/androidx.compose.material3/material3
runtimeOnly 'androidx.compose.material3:material3:1.2.1'
implementation 'androidx.compose.material3:material3:1.2.1'

// AlarmManager for restart service after closed
// Required to avoid crash on Android 12 - API 31
Expand Down Expand Up @@ -126,10 +125,12 @@ dependencies {

implementation 'com.github.dutwrapper:dutwrapper-java:v1.9.0'

implementation 'com.google.android.material:material:1.11.0'
implementation 'com.google.android.material:material:1.12.0'

// Display time ago in news subject
implementation 'com.github.marlonlom:timeago:4.0.3'

implementation 'androidx.core:core-splashscreen:1.2.0-alpha01'
}

// Allow references to generated code
Expand Down
Binary file modified app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 10 additions & 5 deletions app/src/main/java/io/zoemeow/dutschedule/activity/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.graphics.Bitmap
import android.net.Uri
import android.os.Bundle
import android.os.StrictMode
import android.window.SplashScreen
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
Expand All @@ -14,15 +15,18 @@ import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusManager
import androidx.compose.ui.graphics.Color
Expand All @@ -32,6 +36,7 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.platform.SoftwareKeyboardController
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.compose.viewModel
import io.zoemeow.dutschedule.model.settings.BackgroundImageOption
Expand Down Expand Up @@ -72,6 +77,11 @@ abstract class BaseActivity: ComponentActivity() {

permitAllPolicy()
setContent {
// Initialize MainViewModel
if (!isMainViewModelInitialized()) {
mainViewModel = viewModel()
}

// SnackBar state
snackBarHostState = remember { SnackbarHostState() }
snackBarScope = rememberCoroutineScope()
Expand All @@ -80,11 +90,6 @@ abstract class BaseActivity: ComponentActivity() {
focusManager = LocalFocusManager.current
keyboardController = LocalSoftwareKeyboardController.current

// Initialize MainViewModel
if (!isMainViewModelInitialized()) {
mainViewModel = viewModel()
}

DutScheduleTheme(
darkTheme = when (mainViewModel.appSettings.value.themeMode) {
ThemeMode.DarkMode -> true
Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/io/zoemeow/dutschedule/model/NavBarItem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ import androidx.compose.ui.graphics.vector.ImageVector
import io.zoemeow.dutschedule.R

data class NavBarItem(
val title: String,
val titleResId: Int,
val icon: ImageVector? = null,
val resourceIconId: Int? = null,
val route: String
) {
companion object {
val news = NavBarItem(
title = "News",
titleResId = R.string.news_title,
resourceIconId = R.drawable.ic_baseline_newspaper_24,
route = "news"
)

val account = NavBarItem(
title = "Account",
titleResId = R.string.account_title,
icon = Icons.Default.AccountCircle,
route = "account"
)

val notification = NavBarItem(
title = "Notifications",
titleResId = R.string.notification_panel_title,
icon = Icons.Default.Notifications,
route = "notifications"
)

val settings = NavBarItem(
title = "Settings",
titleResId = R.string.settings_title,
icon = Icons.Default.Settings,
route = "settings"
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.component.main

import android.content.Context
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
Expand All @@ -23,6 +24,9 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.intl.Locale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -32,6 +36,7 @@ import io.zoemeow.dutschedule.utils.getRandomString

@Composable
fun NotificationItem(
context: Context,
modifier: Modifier = Modifier,
item: NotificationHistory,
showDate: Boolean = false,
Expand Down Expand Up @@ -66,7 +71,10 @@ fun NotificationItem(
) {
if (showDate) {
Text(
CustomDateUtil.unixToDuration(item.timestamp),
CustomDateUtil.unixToDurationWithLocale(
context = context,
unix = item.timestamp
),
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(bottom = 5.dp)
)
Expand Down Expand Up @@ -117,6 +125,7 @@ private fun Preview1() {
isRead = false
)
NotificationItem(
context = LocalContext.current,
item = notificationHistory
)
}
Expand All @@ -134,6 +143,7 @@ private fun Preview2() {
isRead = false
)
NotificationItem(
context = LocalContext.current,
item = notificationHistory
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.component.news

import android.content.Context
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -30,6 +31,7 @@ import io.zoemeow.dutschedule.utils.CustomDateUtil

@Composable
fun NewsDetailScreen(
context: Context,
newsItem: NewsGlobalItem,
newsType: NewsType,
padding: PaddingValues = PaddingValues(0.dp),
Expand All @@ -38,13 +40,15 @@ fun NewsDetailScreen(
when (newsType) {
NewsType.Global -> {
NewsDetailBody_NewsGlobal(
context = context,
padding = padding,
newsItem = newsItem,
linkClicked = linkClicked
)
}
NewsType.Subject -> {
NewsDetailBody_NewsSubject(
context = context,
padding = padding,
newsItem = newsItem as NewsSubjectItem,
linkClicked = linkClicked
Expand All @@ -55,6 +59,7 @@ fun NewsDetailScreen(

@Composable
private fun NewsDetailBody_NewsGlobal(
context: Context,
padding: PaddingValues,
newsItem: NewsGlobalItem,
linkClicked: ((String) -> Unit)? = null
Expand All @@ -81,7 +86,10 @@ private fun NewsDetailBody_NewsGlobal(
"dd/MM/yyyy",
"UTC"
)
} (${CustomDateUtil.unixToDuration(newsItem.date)})",
} (${CustomDateUtil.unixToDurationWithLocale(
context = context,
unix = newsItem.date
)})",
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.padding(vertical = 7.dp)
)
Expand Down Expand Up @@ -154,6 +162,7 @@ private fun NewsDetailBody_NewsGlobal(

@Composable
private fun NewsDetailBody_NewsSubject(
context: Context,
padding: PaddingValues,
newsItem: NewsSubjectItem,
linkClicked: ((String) -> Unit)? = null
Expand Down Expand Up @@ -184,7 +193,10 @@ private fun NewsDetailBody_NewsSubject(
"dd/MM/yyyy",
"UTC"
)
} (${CustomDateUtil.unixToDuration(newsItem.date)})",
} (${CustomDateUtil.unixToDurationWithLocale(
context = context,
unix = newsItem.date
)})",
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.padding(vertical = 7.dp)
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.view.account

import android.app.Activity.RESULT_OK
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -52,7 +53,7 @@ fun AccountActivity.AccountInformation(
navigationIcon = {
IconButton(
onClick = {
setResult(ComponentActivity.RESULT_OK)
setResult(RESULT_OK)
finish()
},
content = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.view.account

import android.app.Activity.RESULT_OK
import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -30,6 +31,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import io.zoemeow.dutschedule.R
import io.zoemeow.dutschedule.activity.AccountActivity
import io.zoemeow.dutschedule.model.ProcessState
import io.zoemeow.dutschedule.model.account.AccountAuth
Expand Down Expand Up @@ -61,7 +63,7 @@ fun AccountActivity.MainView(
showSnackBar(text = text, clearPrevious = clearPrevious, actionText = actionText, action = action)
},
onBack = {
setResult(ComponentActivity.RESULT_OK)
setResult(RESULT_OK)
finish()
}
)
Expand Down Expand Up @@ -90,7 +92,7 @@ fun AccountMainView(
contentColor = contentColor,
topBar = {
TopAppBar(
title = { Text("Account") },
title = { Text(context.getString(R.string.account_title)) },
colors = TopAppBarDefaults.topAppBarColors(containerColor = Color.Transparent),
navigationIcon = {
if (onBack != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.view.account

import android.app.Activity.RESULT_OK
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -53,7 +54,7 @@ fun AccountActivity.SubjectFee(
navigationIcon = {
IconButton(
onClick = {
setResult(ComponentActivity.RESULT_OK)
setResult(RESULT_OK)
finish()
},
content = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.view.account

import android.app.Activity.RESULT_CANCELED
import androidx.activity.ComponentActivity
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -59,7 +60,7 @@ fun AccountActivity.SubjectInformation(
navigationIcon = {
IconButton(
onClick = {
setResult(ComponentActivity.RESULT_CANCELED)
setResult(RESULT_CANCELED)
finish()
},
content = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.zoemeow.dutschedule.ui.view.account

import android.app.Activity.RESULT_OK
import android.content.Context
import android.content.Intent
import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -61,7 +62,7 @@ fun AccountActivity.TrainingResult(
navigationIcon = {
IconButton(
onClick = {
setResult(ComponentActivity.RESULT_OK)
setResult(RESULT_OK)
finish()
},
content = {
Expand Down
Loading

0 comments on commit fd87fc5

Please sign in to comment.