Skip to content

Commit a0803b6

Browse files
committed
Initial commit
0 parents  commit a0803b6

File tree

106 files changed

+5284
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+5284
-0
lines changed

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties
16+
/.idea/inspectionProfiles/Project_Default.xml
17+
/.idea/.gitignore
18+
/.idea/compiler.xml
19+
/.idea/deploymentTargetDropDown.xml
20+
/.idea/gradle.xml
21+
/.idea/misc.xml
22+
/.idea/vcs.xml
23+
/app/release/app-release.apk
24+
/app/release/output-metadata.json
25+
/app/src/androidTest/java/com/blazecode/eventtool/ExampleInstrumentedTest.kt
26+
/app/src/main/res/values-land/dimens.xml
27+
/app/src/main/res/values-w600dp/dimens.xml
28+
/app/src/main/res/values-w1240dp/dimens.xml
29+
/.idea/copyright/

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
4+
id 'kotlin-kapt'
5+
id 'kotlin-parcelize'
6+
id("com.mikepenz.aboutlibraries.plugin")
7+
}
8+
9+
android {
10+
compileSdk 33
11+
12+
defaultConfig {
13+
applicationId "com.blazecode.eventtool"
14+
minSdk 33
15+
targetSdk 33
16+
versionCode 10
17+
versionName "1.0"
18+
19+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
20+
vectorDrawables {
21+
useSupportLibrary true
22+
}
23+
}
24+
25+
buildTypes {
26+
release {
27+
minifyEnabled false
28+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
29+
}
30+
}
31+
compileOptions {
32+
sourceCompatibility JavaVersion.VERSION_1_8
33+
targetCompatibility JavaVersion.VERSION_1_8
34+
}
35+
kotlinOptions {
36+
jvmTarget = '1.8'
37+
}
38+
buildFeatures {
39+
compose true
40+
viewBinding true
41+
}
42+
composeOptions {
43+
kotlinCompilerExtensionVersion = "1.3.1"
44+
}
45+
packagingOptions {
46+
resources {
47+
excludes += '/META-INF/{AL2.0,LGPL2.1}'
48+
}
49+
}
50+
namespace 'com.blazecode.eventtool'
51+
}
52+
53+
dependencies {
54+
implementation platform('androidx.compose:compose-bom:2022.10.00')
55+
56+
implementation 'androidx.core:core-ktx:1.9.0'
57+
implementation "androidx.compose.ui:ui"
58+
implementation 'androidx.compose.material3:material3'
59+
implementation "androidx.compose.ui:ui-tooling-preview"
60+
implementation 'androidx.lifecycle:lifecycle-viewmodel-compose'
61+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
62+
implementation 'androidx.activity:activity-compose:1.6.1'
63+
implementation 'androidx.appcompat:appcompat:1.5.1'
64+
implementation 'com.google.android.material:material:1.7.0'
65+
implementation 'androidx.annotation:annotation:1.5.0'
66+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
67+
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
68+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
69+
testImplementation 'junit:junit:4.13.2'
70+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
71+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
72+
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
73+
debugImplementation "androidx.compose.ui:ui-tooling"
74+
debugImplementation "androidx.compose.ui:ui-test-manifest"
75+
76+
// ROOM DB
77+
def room_version = "2.4.3"
78+
implementation "androidx.room:room-ktx:$room_version"
79+
kapt "androidx.room:room-compiler:$room_version"
80+
annotationProcessor "androidx.room:room-compiler:$room_version"
81+
82+
// ACCOMPANIST
83+
implementation 'com.google.accompanist:accompanist-flowlayout:0.27.0'
84+
implementation "com.google.accompanist:accompanist-systemuicontroller:0.27.0"
85+
implementation "com.google.accompanist:accompanist-navigation-animation:0.27.0"
86+
87+
// CALENDAR
88+
implementation 'com.kizitonwose.calendar:compose:2.0.2'
89+
90+
// NAVIGATION
91+
implementation("androidx.navigation:navigation-compose:2.5.3")
92+
93+
// GSON
94+
implementation 'com.google.code.gson:gson:2.10'
95+
96+
// LOTTIE
97+
implementation "com.airbnb.android:lottie-compose:5.2.0"
98+
99+
//ABOUT LIBRARIES
100+
implementation("com.mikepenz:aboutlibraries-compose:$ABOUT_LIBRARIES_VERSION")
101+
102+
//DATA STORE
103+
implementation("androidx.datastore:datastore-preferences:1.0.0")
104+
105+
// VOLLEY
106+
implementation 'com.android.volley:volley:1.2.1'
107+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ /*
4+
~ * Copyright (c) BlazeCode / Ralf Lehmann, 2022.
5+
~ */
6+
-->
7+
8+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
9+
xmlns:tools="http://schemas.android.com/tools">
10+
11+
<uses-permission android:name="android.permission.INTERNET" />
12+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
13+
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
14+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
15+
16+
<application
17+
android:allowBackup="true"
18+
android:dataExtractionRules="@xml/data_extraction_rules"
19+
android:enableOnBackInvokedCallback="true"
20+
android:fullBackupContent="@xml/backup_rules"
21+
android:icon="@mipmap/ic_launcher"
22+
android:label="@string/app_name"
23+
android:supportsRtl="true"
24+
android:theme="@style/Theme.EventTool"
25+
tools:targetApi="31">
26+
<activity
27+
android:name=".MainActivity"
28+
android:exported="true"
29+
android:label="@string/app_name"
30+
android:theme="@style/Theme.EventTool">
31+
<intent-filter>
32+
<action android:name="android.intent.action.MAIN" />
33+
34+
<category android:name="android.intent.category.LAUNCHER" />
35+
</intent-filter>
36+
</activity>
37+
38+
<receiver
39+
android:name=".reminders.ReminderBroadcastReceiver"
40+
android:enabled="true" />
41+
42+
<receiver
43+
android:name=".reminders.BootReceiver"
44+
android:enabled="true"
45+
android:exported="true">
46+
<intent-filter>
47+
<action android:name="android.intent.action.BOOT_COMPLETED" />
48+
</intent-filter>
49+
</receiver>
50+
51+
</application>
52+
53+
</manifest>
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
*
3+
* * Copyright (c) BlazeCode / Ralf Lehmann, 2022.
4+
*
5+
*/
6+
7+
package com.blazecode.eventtool
8+
9+
import android.os.Bundle
10+
import android.widget.Toast
11+
import androidx.activity.ComponentActivity
12+
import androidx.activity.compose.setContent
13+
import androidx.compose.animation.ExperimentalAnimationApi
14+
import androidx.compose.material3.*
15+
import androidx.compose.runtime.mutableStateOf
16+
import androidx.compose.ui.res.stringResource
17+
import androidx.lifecycle.lifecycleScope
18+
import com.blazecode.eventtool.data.Event
19+
import com.blazecode.eventtool.database.DataBaseExporter
20+
import com.blazecode.eventtool.database.DataBaseImporter
21+
import com.blazecode.eventtool.navigation.NavRoutes
22+
import com.blazecode.eventtool.screens.*
23+
import com.blazecode.eventtool.ui.theme.EventToolTheme
24+
import com.blazecode.eventtool.util.PermissionManager
25+
import com.blazecode.eventtool.util.pdf.PdfPrinter
26+
import com.blazecode.eventtool.viewmodels.HomeViewModel
27+
import com.blazecode.eventtool.viewmodels.NewEventViewModel
28+
import com.blazecode.eventtool.viewmodels.SettingsViewModel
29+
import com.google.accompanist.navigation.animation.AnimatedNavHost
30+
import com.google.accompanist.navigation.animation.composable
31+
import com.google.accompanist.navigation.animation.rememberAnimatedNavController
32+
import kotlinx.coroutines.launch
33+
34+
var errorDialogMessage = mutableStateOf("")
35+
var notificationTapEvent = mutableStateOf<Event?>(null)
36+
37+
class MainActivity : ComponentActivity() {
38+
@OptIn(ExperimentalAnimationApi::class)
39+
override fun onCreate(savedInstanceState: Bundle?) {
40+
super.onCreate(savedInstanceState)
41+
42+
// HACKY WAY TO PREVENT WHITE SCREEN BETWEEN TRANSITIONS
43+
lifecycleScope.launch {
44+
window.setBackgroundDrawableResource(android.R.color.transparent)
45+
}
46+
47+
// GET EVENT IF TAPPED NOTIFICATION
48+
notificationTapEvent.value = intent.extras?.getParcelable("event", Event::class.java)
49+
50+
val permissionManager = PermissionManager(this)
51+
52+
val exporter = DataBaseExporter(this)
53+
val importer = DataBaseImporter(this)
54+
val printer = PdfPrinter(this)
55+
// CONTENT
56+
setContent {
57+
val navController = rememberAnimatedNavController()
58+
AnimatedNavHost(navController = navController, startDestination = NavRoutes.Home.route) {
59+
// HOME
60+
composable(route= NavRoutes.Home.route,) { Home(HomeViewModel(application), navController, printer) }
61+
// NEW EVENT
62+
composable(NavRoutes.NewEvent.route) {
63+
val event = navController.previousBackStackEntry?.savedStateHandle?.get<Event>("event")
64+
event?.let {
65+
NewEvent(NewEventViewModel(application, event), navController) }
66+
}
67+
// SETTINGS
68+
composable(NavRoutes.Settings.route){ Settings(SettingsViewModel(application), navController, permissionManager, exporter, importer) }
69+
// OPEN SOURCE LICENSES
70+
composable(NavRoutes.OpenSourceLicenses.route){ OpenSourceLicenses(navController) }
71+
}
72+
73+
// ERROR DIALOG
74+
EventToolTheme {
75+
if(errorDialogMessage.value != ""){
76+
AlertDialog(
77+
onDismissRequest = { errorDialogMessage.value = "" },
78+
title = { Text(stringResource(R.string.error)) },
79+
text = { Text(errorDialogMessage.value) },
80+
confirmButton = { OutlinedButton(onClick = { errorDialogMessage.value = "" })
81+
{ Text(stringResource(R.string.close)) } }
82+
)
83+
}
84+
}
85+
}
86+
}
87+
88+
fun sendToast(text:String){
89+
Toast.makeText(this, text, Toast.LENGTH_LONG).show()
90+
println(text)
91+
}
92+
93+
fun sendErrorDialog(text: String){
94+
errorDialogMessage.value = text
95+
}
96+
}
97+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
*
3+
* * Copyright (c) BlazeCode / Ralf Lehmann, 2022.
4+
*
5+
*/
6+
7+
package com.blazecode.eventtool.data
8+
9+
import android.os.Parcelable
10+
import androidx.room.ColumnInfo
11+
import androidx.room.Entity
12+
import androidx.room.PrimaryKey
13+
import com.blazecode.eventtool.enums.Additions
14+
import com.blazecode.eventtool.enums.EventType
15+
import kotlinx.parcelize.Parcelize
16+
import java.time.LocalDate
17+
import java.time.LocalTime
18+
19+
@Entity
20+
@Parcelize
21+
data class Event(
22+
@PrimaryKey(autoGenerate = true) var id: Int?,
23+
@ColumnInfo var eventType: EventType = EventType.UNKNOWN,
24+
@ColumnInfo var date: LocalDate = LocalDate.now(),
25+
@ColumnInfo var name: String = "",
26+
@ColumnInfo var firstName1: String = "",
27+
@ColumnInfo var firstName2: String = "",
28+
@ColumnInfo var lastName: String = "",
29+
@ColumnInfo var venue: String = "",
30+
@ColumnInfo var timeReady: LocalTime = LocalTime.of(LocalTime.now().hour, 0),
31+
@ColumnInfo var timeStart: LocalTime = LocalTime.of(LocalTime.now().hour, 0),
32+
@ColumnInfo var timeGuests: LocalTime = LocalTime.of(LocalTime.now().hour, 0),
33+
@ColumnInfo var timeEnd: LocalTime = LocalTime.of(LocalTime.now().hour, 0),
34+
@ColumnInfo var guestAmount: String = "0",
35+
@ColumnInfo var childrenAmount: String = "0",
36+
@ColumnInfo var additions: MutableList<Additions> = mutableListOf(),
37+
@ColumnInfo var wishMusic: String = "",
38+
@ColumnInfo var comments: String = "",
39+
@ColumnInfo var email: String = "",
40+
@ColumnInfo var phone: String = ""
41+
) : Parcelable
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
*
3+
* * Copyright (c) BlazeCode / Ralf Lehmann, 2022.
4+
*
5+
*/
6+
7+
package com.blazecode.eventtool.data
8+
9+
import com.blazecode.eventtool.enums.EventType
10+
import com.kizitonwose.calendar.core.CalendarDay
11+
import com.kizitonwose.calendar.core.DayPosition
12+
import java.time.LocalDate
13+
14+
data class EventDateType(
15+
val date: CalendarDay = CalendarDay(LocalDate.now(), DayPosition.MonthDate),
16+
val type: EventType = EventType.UNKNOWN
17+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
*
3+
* * Copyright (c) BlazeCode / Ralf Lehmann, 2022.
4+
*
5+
*/
6+
7+
package com.blazecode.eventtool.data
8+
9+
data class PdfLine(
10+
var title: String = "",
11+
var data: String = ""
12+
)

0 commit comments

Comments
 (0)