diff --git a/.gradle/8.9/checksums/checksums.lock b/.gradle/8.9/checksums/checksums.lock new file mode 100644 index 0000000..4cccd39 Binary files /dev/null and b/.gradle/8.9/checksums/checksums.lock differ diff --git a/.gradle/8.9/checksums/md5-checksums.bin b/.gradle/8.9/checksums/md5-checksums.bin new file mode 100644 index 0000000..397b128 Binary files /dev/null and b/.gradle/8.9/checksums/md5-checksums.bin differ diff --git a/.gradle/8.9/checksums/sha1-checksums.bin b/.gradle/8.9/checksums/sha1-checksums.bin new file mode 100644 index 0000000..6dc46c7 Binary files /dev/null and b/.gradle/8.9/checksums/sha1-checksums.bin differ diff --git a/.gradle/8.9/dependencies-accessors/gc.properties b/.gradle/8.9/dependencies-accessors/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/8.9/fileChanges/last-build.bin b/.gradle/8.9/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/.gradle/8.9/fileChanges/last-build.bin differ diff --git a/.gradle/8.9/fileHashes/fileHashes.bin b/.gradle/8.9/fileHashes/fileHashes.bin new file mode 100644 index 0000000..9ac0cd5 Binary files /dev/null and b/.gradle/8.9/fileHashes/fileHashes.bin differ diff --git a/.gradle/8.9/fileHashes/fileHashes.lock b/.gradle/8.9/fileHashes/fileHashes.lock new file mode 100644 index 0000000..3424631 Binary files /dev/null and b/.gradle/8.9/fileHashes/fileHashes.lock differ diff --git a/.gradle/8.9/gc.properties b/.gradle/8.9/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 9eac8a2..ab2661d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,52 +2,50 @@ apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { - compileSdkVersion 27 + compileSdkVersion 34 defaultConfig { applicationId "com.dineout" minSdkVersion 21 - targetSdkVersion 27 + targetSdkVersion 34 versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) + // AndroidX dependencies (migrated from support libraries) + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.recyclerview:recyclerview:1.2.1' + implementation 'androidx.cardview:cardview:1.0.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.annotation:annotation:1.3.0' - //implementation 'com.android.support:recyclerview-v7:28.0.0' - //implementation 'com.android.support:cardview-v7:28.0.0' - //implementation 'com.android.support:support-v4:28.0.0' - //implementation 'com.android.support:appcompat-v7:28.0.0' - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - - implementation 'com.android.support:appcompat-v7:27.1.1' - implementation 'com.android.support:recyclerview-v7:27.1.1' - implementation 'com.android.support.constraint:constraint-layout:1.1.3' - implementation 'com.google.firebase:firebase-database:16.0.1' - implementation 'com.android.support:cardview-v7:27.1.1' - - implementation 'com.google.firebase:firebase-core:16.0.5' - implementation 'com.google.firebase:firebase-auth:16.0.5' - implementation 'com.google.firebase:firebase-database:16.0.5' + // Firebase dependencies (updated versions) + implementation 'com.google.firebase:firebase-core:21.1.1' + implementation 'com.google.firebase:firebase-auth:22.1.0' + implementation 'com.google.firebase:firebase-database:20.3.0' + // Other dependencies implementation 'com.hrules:horizontalnumberpicker:1.1.1' - - implementation 'com.android.support:support-annotations:27.1.1' - - implementation 'com.sun.mail:android-mail:1.5.5' implementation 'com.sun.mail:android-activation:1.5.5' implementation 'com.itextpdf:itextg:5.5.10' + + // Test dependencies + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test:runner:1.5.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } diff --git a/app/src/main/java/com/dineout/code/admin/AdminPanelActivity.java b/app/src/main/java/com/dineout/code/admin/AdminPanelActivity.java index ca66040..ac96dd1 100644 --- a/app/src/main/java/com/dineout/code/admin/AdminPanelActivity.java +++ b/app/src/main/java/com/dineout/code/admin/AdminPanelActivity.java @@ -210,43 +210,41 @@ public boolean onOptionsItemSelected(MenuItem item) { } } - public void checkdate() { - firebaseDatabase = FirebaseDatabase.getInstance(); //FIREBASE DATABASE KA OBJECT GET KIA - - databaseReference = firebaseDatabase.getReference("Date"); //TABLE LIA - - databaseReference.addChildEventListener(new ChildEventListener() { - public void onChildAdded(DataSnapshot dataSnapshot, String previousKey) { - - date1 = dataSnapshot.getValue(String.class); - DateFormat f = new SimpleDateFormat("dd-MM-yyyy"); - d1 = f.parse(date, new ParsePosition(0)); - d2 = f.parse(date1, new ParsePosition(0)); - - if (d1.compareTo(d2) == 0) { - DatabaseReference ref1 = FirebaseDatabase.getInstance().getReference(); - ref1.child("Date").child("date").setValue(date); - checkdb(); - } - - - } - - public void onChildChanged(DataSnapshot dataSnapshot, String s) { - } - - public void onChildRemoved(DataSnapshot dataSnapshot) { - } - - public void onChildMoved(DataSnapshot dataSnapshot, String s) { + public void checkDate() { + // Get the current date + String currentDate = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date()); + + // Get the stored date from Firebase Realtime Database + DatabaseReference dateReference = FirebaseDatabase.getInstance().getReference("Date"); + dateReference.addChildEventListener(new ChildEventListener() { + @Override + public void onChildAdded(DataSnapshot dataSnapshot, String previousKey) { + String storedDate = dataSnapshot.getValue(String.class); + + // Compare the current date with the stored date + if (isSameDate(currentDate, storedDate)) { + // Update the stored date in Firebase Realtime Database + dateReference.child("date").setValue(currentDate); + + // Check the database for notifications + checkDatabase(); } + } - @Override - public void onCancelled(@NonNull DatabaseError databaseError) { + // Other methods of ChildEventListener + }); +} - } - }); +private boolean isSameDate(String date1, String date2) { + try { + DateFormat f = new SimpleDateFormat("dd-MM-yyyy"); + Date d1 = f.parse(date1); + Date d2 = f.parse(date2); + return d1.compareTo(d2) == 0; + } catch (ParseException e) { + return false; } +} public void checkdb() { firebaseDatabase = FirebaseDatabase.getInstance(); //FIREBASE DATABASE KA OBJECT GET KIA diff --git a/build.gradle b/build.gradle index a9ca315..2d56eac 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,17 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - repositories { google() - jcenter() + mavenCentral() // Use Maven Central instead of JCenter } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' - classpath 'com.google.gms:google-services:4.0.1' - + // Updated Android Gradle Plugin + classpath 'com.android.tools.build:gradle:8.1.0' + + // Updated Google Services plugin for Firebase integration + classpath 'com.google.gms:google-services:4.3.15' + // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } @@ -18,7 +20,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() // Replacing JCenter with Maven Central } } diff --git a/gradle.properties b/gradle.properties index 82618ce..bb60cc2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,15 +1,14 @@ # Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true +# JVM arguments for the Gradle daemon process +org.gradle.jvmargs=-Xmx2g +# Enable parallel build (optional, recommended for large multi-module projects) +org.gradle.parallel=true + +# Enable the Gradle Daemon for faster builds +org.gradle.daemon=true + +# If using AndroidX, these properties should be set +android.useAndroidX=true +android.enableJetifier=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9a4163a..40714c1 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,8 @@ +#Sat Oct 19 03:16:24 IST 2024 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +android.useAndroidX=true +android.enableJetifier=true