Skip to content

Commit

Permalink
Merge pull request #228 from aritra-tech/develop
Browse files Browse the repository at this point in the history
v1.7.1
  • Loading branch information
aritra-tech authored Nov 5, 2023
2 parents 7d6172d + 98df20f commit fa77924
Show file tree
Hide file tree
Showing 64 changed files with 2,211 additions and 949 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout the code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
Expand Down
4 changes: 2 additions & 2 deletions .idea/deploymentTargetDropDown.xml

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

1 change: 1 addition & 0 deletions .idea/gradle.xml

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

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId = "com.aritra.notify"
minSdk = 24
targetSdk = 34
versionCode = 9
versionName = "1.6.1"
versionCode = 10
versionName = "1.7.1"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand Down Expand Up @@ -42,6 +44,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".services.reciever.ReminderNoteNotificationBroadcast" />
</application>

</manifest>
8 changes: 7 additions & 1 deletion app/src/main/java/com/aritra/notify/NotifyApplication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package com.aritra.notify

import android.app.Application
import com.aritra.notify.services.notification.createNotificationChannel
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class NotifyApplication : Application()
class NotifyApplication : Application() {
override fun onCreate() {
super.onCreate()
createNotificationChannel(this)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fun BottomSheetOptions(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.clickable { onClick() }
.padding(16.dp)
.padding(12.dp)
) {
Icon(
painter = icon,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
package com.aritra.notify.components.appbar

import android.Manifest
import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.PickVisualMediaRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.navigationBarsPadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.BottomAppBar
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.aritra.notify.R
import com.aritra.notify.components.actions.BottomSheetOptions
import com.aritra.notify.components.actions.SpeechRecognizerContract
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.google.accompanist.permissions.isGranted
import com.google.accompanist.permissions.rememberPermissionState

@OptIn(ExperimentalMaterial3Api::class, ExperimentalPermissionsApi::class)
@Composable
fun AddEditBottomBar(
modifier: Modifier = Modifier,
onImagesSelected: (List<Uri>) -> Unit,
onSpeechRecognized: (String) -> Unit,
showDrawingScreen: () -> Unit,
showCameraSheet: () -> Unit,
onReminderDateTime: () -> Unit,
addTodo: () -> Unit,
) {
var showSheet by remember { mutableStateOf(false) }
val sheetState = rememberModalBottomSheetState()

val microphonePermissionState = rememberPermissionState(Manifest.permission.RECORD_AUDIO)
val cameraPermissionState = rememberPermissionState(Manifest.permission.CAMERA)

val imageLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.PickMultipleVisualMedia(),
onResult = { uris ->
onImagesSelected(uris)
}
)
val speechLauncher = rememberLauncherForActivityResult(
contract = SpeechRecognizerContract(),
onResult = { words ->
if (words.isNullOrEmpty()) {
return@rememberLauncherForActivityResult
}
onSpeechRecognized(words.joinToString(separator = " "))
}
)

BottomAppBar(
modifier = modifier
.navigationBarsPadding()
.imePadding(),
containerColor = Color.Transparent,
content = {
IconButton(
onClick = { showSheet = true },
content = {
Icon(
modifier = Modifier.size(25.dp),
painter = painterResource(id = R.drawable.add_box_icon),
contentDescription = stringResource(R.string.add_box)
)
}
)
IconButton(onClick = { onReminderDateTime() }) {
Icon(
modifier = Modifier.size(25.dp),
painter = painterResource(id = R.drawable.add_alert),
contentDescription = stringResource(R.string.add_box)
)
}
if (showSheet) {
ModalBottomSheet(
onDismissRequest = { showSheet = false },
sheetState = sheetState,
dragHandle = { BottomSheetDefaults.DragHandle() },
content = {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
content = {
BottomSheetOptions(
text = stringResource(R.string.take_image),
icon = painterResource(id = R.drawable.camera),
onClick = {
if (cameraPermissionState.status.isGranted) {
showCameraSheet()
} else {
cameraPermissionState.launchPermissionRequest()
}
showSheet = false
}
)
BottomSheetOptions(
text = stringResource(R.string.add_image),
icon = painterResource(id = R.drawable.gallery),
onClick = {
imageLauncher.launch(
PickVisualMediaRequest(
mediaType = ActivityResultContracts.PickVisualMedia.ImageOnly
)
)
showSheet = false
}
)
BottomSheetOptions(
text = stringResource(R.string.drawing),
icon = painterResource(id = R.drawable.drawing),
onClick = {
showDrawingScreen()
showSheet = false
}
)
BottomSheetOptions(
text = stringResource(R.string.speech_to_text),
icon = painterResource(id = R.drawable.mic_icon),
onClick = {
if (microphonePermissionState.status.isGranted) {
speechLauncher.launch(Unit)
} else {
microphonePermissionState.launchPermissionRequest()
}
showSheet = false
}
)
BottomSheetOptions(
text = stringResource(R.string.add_todo),
icon = painterResource(id = R.drawable.add_box_icon),
onClick = {
addTodo()
showSheet = false
}
)
}
)
}
)
}
}
)
}
Loading

0 comments on commit fa77924

Please sign in to comment.