Skip to content
Open
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
30 changes: 24 additions & 6 deletions .idea/misc.xml

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

14 changes: 13 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-android'
id 'kotlin-android-extensions'
}


android {
compileSdk 32

defaultConfig {
applicationId "com.example.enotes"
minSdk 26
minSdk 25
targetSdk 32
versionCode 1
versionName "1.0"
Expand All @@ -23,6 +25,9 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -53,4 +58,11 @@ dependencies {
implementation 'com.github.Miihir79:DrawingCanvas:1.1.2'
implementation 'com.github.DonghanX:Draw:v1.0.3'

// dependencies for Api integration | Retrofit 2
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2'

}
24 changes: 14 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
Expand All @@ -19,40 +20,43 @@
android:supportsRtl="true"
android:theme="@style/Theme.ENotes"
tools:targetApi="31">
<activity
android:name=".activities.OpenImageActivity"
android:exported="false" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/map_key" />

<activity
android:name=".ViewNotes"
android:name=".activities.EditNoteActivity"
android:exported="false" />
<activity
android:name=".Text_note"
android:name=".activities.AddNoteActivity"
android:exported="false" />
<activity
android:name=".Login"
android:name=".activities.LoginActivity"
android:exported="false" />
<activity
android:name=".Signup"
android:name=".activities.SignupActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:name=".activities.NoteListActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver android:name=".BroadcastService"

<receiver
android:name=".BroadcastService"
android:exported="true">
<intent-filter>
<action android:name="com.myaction.com">
</action>
<action android:name="com.myaction.com"></action>
</intent-filter>

</receiver>

</application>

</manifest>
29 changes: 23 additions & 6 deletions app/src/main/java/com/example/enotes/BroadcastService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ package com.example.enotes
import android.R
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import android.util.Log
import android.widget.Toast
import androidx.core.app.NotificationCompat

import android.os.Build
import androidx.core.app.NotificationManagerCompat
import com.example.enotes.activities.NoteListActivity


const val notificationID = 1
Expand All @@ -29,11 +30,21 @@ class BroadcastService : BroadcastReceiver() {

override fun onReceive(context: Context, intent: Intent) {

var time= intent.getStringExtra("time")
val time= intent.getStringExtra("time")
Toast.makeText(context, "Successful", Toast.LENGTH_SHORT).show()
val title= intent.getStringExtra("title")


createNotificationChannel(context)
notifyNotification(context,time)
val notificationIntent = Intent(context, NoteListActivity::class.java)
notificationIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP

val pendingIntent = PendingIntent.getActivity(
context, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT
)

notifyNotification(context,time, title,pendingIntent)


if (time != null) {
Expand All @@ -54,12 +65,18 @@ class BroadcastService : BroadcastReceiver() {
}
}

private fun notifyNotification(context: Context, time: String?) {
private fun notifyNotification(
context: Context,
time: String?,
title: String?,
pendingIntent: PendingIntent
) {
with(NotificationManagerCompat.from(context)) {
val build = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
.setContentTitle(time)
.setContentText("Alarm.")
.setContentText(title)
.setSmallIcon(R.drawable.ic_lock_idle_alarm)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)

notify(NOTIFICATION_ID, build.build())
Expand Down
32 changes: 0 additions & 32 deletions app/src/main/java/com/example/enotes/Login.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/java/com/example/enotes/Signup.kt

This file was deleted.

Loading