Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

merge dev with master #75

Merged
merged 20 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ jobs:
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Build Debug APK
run: ./gradlew assembleDebug
- name: Create APK directory
run: mkdir -p apk
- name: Copy APK to directory
run: cp app/build/outputs/apk/debug/*.apk apk/
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.thatsmanmeet.taskyapp"
minSdk 26
targetSdk 34
versionCode 24
versionName "2.4.0"
versionCode 25
versionName "2.4.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
Expand Down Expand Up @@ -64,6 +64,7 @@ dependencies {
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.compose.material3:material3:1.2.0-alpha06'
implementation 'androidx.media3:media3-common:1.2.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
79 changes: 79 additions & 0 deletions app/schemas/com.thatsmanmeet.taskyapp.room.TodoDatabase/4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"formatVersion": 1,
"database": {
"version": 4,
"identityHash": "ba7463236f237b93f55f7180888e06e3",
"entities": [
{
"tableName": "todo_table",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`ID` INTEGER PRIMARY KEY AUTOINCREMENT, `title` TEXT, `completed` INTEGER NOT NULL, `date` TEXT, `time` TEXT, `notificationID` INTEGER NOT NULL DEFAULT 0, `is_Recurring` INTEGER NOT NULL DEFAULT false, `description` TEXT DEFAULT '')",
"fields": [
{
"fieldPath": "ID",
"columnName": "ID",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "isCompleted",
"columnName": "completed",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "date",
"columnName": "date",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "notificationID",
"columnName": "notificationID",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "0"
},
{
"fieldPath": "isRecurring",
"columnName": "is_Recurring",
"affinity": "INTEGER",
"notNull": true,
"defaultValue": "false"
},
{
"fieldPath": "todoDescription",
"columnName": "description",
"affinity": "TEXT",
"notNull": false,
"defaultValue": "''"
}
],
"primaryKey": {
"autoGenerate": true,
"columnNames": [
"ID"
]
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'ba7463236f237b93f55f7180888e06e3')"
]
}
}
28 changes: 25 additions & 3 deletions app/src/main/java/com/thatsmanmeet/taskyapp/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package com.thatsmanmeet.taskyapp
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
Expand All @@ -16,10 +17,12 @@ import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.ScaffoldDefaults
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
Expand Down Expand Up @@ -54,8 +57,7 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
installSplashScreen()
setContent {
Scaffold(contentWindowInsets = ScaffoldDefaults.contentWindowInsets) {
it;
Scaffold(contentWindowInsets = ScaffoldDefaults.contentWindowInsets) {paddingValues->
val context = LocalContext.current
val viewModel = MainViewModel()
val pageState = remember {
Expand Down Expand Up @@ -89,7 +91,7 @@ class MainActivity : ComponentActivity() {
} else {
PermissionRequestScreen(navHostController = navController, requestOnClick = {
notificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
})
}, modifier = Modifier.padding(paddingValues))
}
}
// If permissions are already accepted.
Expand Down Expand Up @@ -184,6 +186,26 @@ class MainActivity : ComponentActivity() {
}
}
}
@Deprecated("Deprecated in Java")
override fun onBackPressed() {
val currentRoute = navController.currentBackStackEntry?.destination?.route
if(currentRoute == Screen.MyApp.route){
AlertDialog.Builder(this,android.R.style.Theme_DeviceDefault_Dialog)
.setTitle("Confirm Exit ?")
.setMessage("Are you sure you want to exit?")
.setPositiveButton("Yes") { _, _ ->
//super.onBackPressed()
finish()
}
.setNegativeButton("No") { dialog, _ ->
dialog.cancel()
}
.show()
}
else{
super.onBackPressed()
}
}

@Throws(IOException::class)
private fun copyStream(input: InputStream, output: OutputStream) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.thatsmanmeet.taskyapp.components

import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.DateRange
Expand Down Expand Up @@ -51,7 +52,7 @@ fun addTodoDialog(
if (openDialog.value) {
AlertDialog(
onDismissRequest = {
openDialog.value = false
//openDialog.value = false
enteredText1 = ""
},
title = { Text(text = stringResource(R.string.add_task_dialog_title)) },
Expand All @@ -63,15 +64,18 @@ fun addTodoDialog(
onValueChange = { textChange ->
enteredText1 = textChange
},
maxLines = 1
maxLines = 1,
singleLine = true
)
Spacer(modifier = modifier.height(10.dp))
OutlinedTextField(
value = descriptionText,
placeholder = { Text(text = "Description")},
onValueChange = {descriptionTextChange->
descriptionText = descriptionTextChange
})
},
maxLines = 4
)
Spacer(modifier = modifier.height(10.dp))
Text(text = stringResource(R.string.add_edit_dialog_set_reminder_title))
Spacer(modifier = modifier.height(10.dp))
Expand Down Expand Up @@ -159,55 +163,61 @@ fun addTodoDialog(
},
confirmButton = {
Button(onClick = {
val todo = Todo(
ID = null,
enteredText1.ifEmpty { "No Name" },
isCompleted = false,
date = dateText.value.ifEmpty {
SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH).format(
if (enteredText1.isNotEmpty() && descriptionText.isNotEmpty()){
val todo = Todo(
ID = null,
title = enteredText1,
//enteredText1.ifEmpty { "No Name" },
isCompleted = false,
date = dateText.value.ifEmpty {
SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH).format(
Calendar.getInstance().time
).toString()
},
time = timeText.value,
notificationID = ((0..2000).random() - (0..50).random()),
isRecurring = isRepeating,
todoDescription = descriptionText
)
todoViewModel.insertTodo(
todo
)
if(dateText.value.isEmpty()){
dateText.value = SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH).format(
Calendar.getInstance().time
).toString()
},
time = timeText.value,
notificationID = ((0..2000).random() - (0..50).random()),
isRecurring = isRepeating,
todoDescription = descriptionText
)
todoViewModel.insertTodo(
todo
)
if(dateText.value.isEmpty()){
dateText.value = SimpleDateFormat("dd/MM/yyyy", Locale.ENGLISH).format(
Calendar.getInstance().time
).toString()
}
if (dateText.value.isNotEmpty() && timeText.value.isNotEmpty()) {
// SCHEDULE NOTIFICATION
val format = SimpleDateFormat("dd/MM/yyyy", Locale.getDefault())
val parsedDate = format.parse(dateText.value)
val calendar = Calendar.getInstance().apply {
time = parsedDate!!
set(Calendar.HOUR_OF_DAY, todo.time!!.substringBefore(":").toInt())
set(Calendar.MINUTE, todo.time!!.substringAfter(":").toInt())
set(Calendar.SECOND, 0)
}
if(calendar.timeInMillis > Calendar.getInstance().timeInMillis){
if (dateText.value.isNotEmpty() && timeText.value.isNotEmpty()) {
// SCHEDULE NOTIFICATION
val format = SimpleDateFormat("dd/MM/yyyy", Locale.getDefault())
val parsedDate = format.parse(dateText.value)
val calendar = Calendar.getInstance().apply {
time = parsedDate!!
set(Calendar.HOUR_OF_DAY, todo.time!!.substringBefore(":").toInt())
set(Calendar.MINUTE, todo.time!!.substringAfter(":").toInt())
set(Calendar.SECOND, 0)
}
if(calendar.timeInMillis > Calendar.getInstance().timeInMillis){
scheduleNotification(
context,
titleText = enteredText1,
messageText = descriptionText,
time = "${dateText.value} ${timeText.value}",
todo = todo
)
}
if(isRepeating){
setRepeatingAlarm(context = context)
}
}
if(isRepeating){
setRepeatingAlarm(context = context)
}
openDialog.value = false
enteredText1 = ""
descriptionText = ""
isRepeating = false
}
else{
Toast.makeText(context,"Fill in all fields",Toast.LENGTH_SHORT).show()
}
openDialog.value = false
enteredText1 = ""
descriptionText = ""
isRepeating = false
}
) {
Text(text = stringResource(R.string.add_edit_dialog_add_button_text))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,19 @@ fun OpenEditTodoDialog(
placeholder = { Text(text = stringResource(id = R.string.add_edit_text_placeholder)) },
onValueChange = { textChange ->
currentTodoTitle.value = textChange
}
},
maxLines = 1,
singleLine = true
)
Spacer(modifier = modifier.height(10.dp))
OutlinedTextField(
value = currentDescriptionText,
placeholder = { Text(text = "Description")},
onValueChange = {descriptionTextChange->
currentDescriptionText = descriptionTextChange
})
},
maxLines = 4
)
Spacer(modifier = modifier.height(12.dp))
Text(text = stringResource(R.string.add_edit_dialog_edit_reminder_title))
Spacer(modifier = modifier.height(10.dp))
Expand Down
Loading