Renames the app (label, texts, User-Agent, PRODID, APK) and uses the new launcher icon pack (ldpi to xhdpi, master in art/) instead of drawing one at build time. Reminders show a white calendar glyph in the status bar (stat_notify, 18-48 px) instead of the system's colour alarm clock, which didn't fit the Gingerbread bar. The package name, database and signing key stay, so it installs over GingerCal and keeps its data. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
package org.gingercal;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.PowerManager;
|
|
|
|
/** Boot, periodic-sync and reminder alarms all land here. */
|
|
public class AlarmReceiver extends BroadcastReceiver {
|
|
public static final String SYNC = "org.gingercal.SYNC";
|
|
public static final String REMIND = "org.gingercal.REMIND";
|
|
private static PowerManager.WakeLock lock;
|
|
|
|
@Override
|
|
public void onReceive(Context c, Intent i) {
|
|
String a = i.getAction();
|
|
if (REMIND.equals(a)) {
|
|
Reminders.fire(c);
|
|
} else if (SYNC.equals(a)) {
|
|
acquire(c);
|
|
App.requestSync(c, false, false);
|
|
} else {
|
|
// BOOT_COMPLETED / package replaced: alarms don't survive either
|
|
App.scheduleSync(c);
|
|
Reminders.schedule(c);
|
|
}
|
|
}
|
|
|
|
static synchronized void acquire(Context c) {
|
|
if (lock == null) {
|
|
PowerManager pm = (PowerManager) c.getApplicationContext().getSystemService("power");
|
|
lock = pm.newWakeLock(1 /* PARTIAL_WAKE_LOCK */, "Calendar Lite sync");
|
|
lock.setReferenceCounted(false);
|
|
}
|
|
lock.acquire(5 * 60 * 1000L);
|
|
}
|
|
|
|
static synchronized void release() {
|
|
if (lock != null && lock.isHeld()) lock.release();
|
|
}
|
|
}
|