fix(android): fix Java calls to Kotlin companion object methods
Fix Java compilation errors when calling Kotlin companion object methods.
Fixes:
- isAlarmScheduled(): Use NotifyReceiver.Companion with correct parameter types
- getNextAlarmTime(): Use NotifyReceiver.Companion with correct return type
- Kotlin Long? maps to java.lang.Long in Java (no conversion needed)
Errors Fixed:
- cannot find symbol: isAlarmScheduled(Context, String, Long)
- cannot find symbol: getNextAlarmTime(Context)
Verification:
- Java compilation: PASS
- Full assembleDebug build: BUILD SUCCESSFUL ✅
This commit is contained in:
@@ -587,10 +587,13 @@ public class DailyNotificationScheduler {
|
|||||||
public boolean isScheduled(String scheduleId, Long triggerAtMillis) {
|
public boolean isScheduled(String scheduleId, Long triggerAtMillis) {
|
||||||
try {
|
try {
|
||||||
// Delegate to NotifyReceiver which checks actual AlarmManager state
|
// Delegate to NotifyReceiver which checks actual AlarmManager state
|
||||||
return com.timesafari.dailynotification.NotifyReceiver.isAlarmScheduled(
|
// Note: NotifyReceiver.isAlarmScheduled is a Kotlin companion object function with default parameters
|
||||||
|
// From Java, we need to use Companion and provide explicit values (null is acceptable for optional params)
|
||||||
|
// Kotlin Long? maps to java.lang.Long in Java
|
||||||
|
return com.timesafari.dailynotification.NotifyReceiver.Companion.isAlarmScheduled(
|
||||||
context,
|
context,
|
||||||
scheduleId != null ? scheduleId : null,
|
scheduleId,
|
||||||
triggerAtMillis != null ? triggerAtMillis : null
|
triggerAtMillis
|
||||||
);
|
);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Error checking alarm schedule status", e);
|
Log.e(TAG, "Error checking alarm schedule status", e);
|
||||||
@@ -618,7 +621,9 @@ public class DailyNotificationScheduler {
|
|||||||
public Long getNextAlarmTime() {
|
public Long getNextAlarmTime() {
|
||||||
try {
|
try {
|
||||||
// Delegate to NotifyReceiver which checks actual AlarmManager state
|
// Delegate to NotifyReceiver which checks actual AlarmManager state
|
||||||
return com.timesafari.dailynotification.NotifyReceiver.getNextAlarmTime(context);
|
// Note: NotifyReceiver.getNextAlarmTime is a Kotlin companion object function
|
||||||
|
// Kotlin Long? maps to java.lang.Long in Java
|
||||||
|
return com.timesafari.dailynotification.NotifyReceiver.Companion.getNextAlarmTime(context);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "Error getting next alarm time", e);
|
Log.e(TAG, "Error getting next alarm time", e);
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user