Fixed notification and made code slightly simpler
This commit is contained in:
@ -32,7 +32,7 @@ public class ProofOfWorkNotification extends AbstractNotification {
|
||||
|
||||
public ProofOfWorkNotification(Context ctx) {
|
||||
super(ctx);
|
||||
update(1);
|
||||
update(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,7 +52,9 @@ public class ProofOfWorkNotification extends AbstractNotification {
|
||||
.setOngoing(true)
|
||||
.setSmallIcon(R.drawable.ic_notification_proof_of_work)
|
||||
.setContentTitle(ctx.getString(R.string.proof_of_work_title))
|
||||
.setContentText(ctx.getString(R.string.proof_of_work_text, numberOfItems))
|
||||
.setContentText(numberOfItems == 0
|
||||
? ctx.getString(R.string.proof_of_work_text_0)
|
||||
: ctx.getString(R.string.proof_of_work_text_n, numberOfItems))
|
||||
.setContentIntent(pendingIntent);
|
||||
|
||||
notification = builder.build();
|
||||
|
@ -37,19 +37,13 @@ import static ch.dissem.apps.abit.notification.ProofOfWorkNotification.ONGOING_N
|
||||
*/
|
||||
public class ProofOfWorkService extends Service {
|
||||
// Object to use as a thread-safe lock
|
||||
private static final Object lock = new Object();
|
||||
private static ProofOfWorkEngine engine;
|
||||
private static ProofOfWorkEngine engine = new MultiThreadedPOWEngine();
|
||||
private static boolean calculating;
|
||||
private static final Queue<PowItem> queue = new LinkedList<>();
|
||||
private static ProofOfWorkNotification notification;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
synchronized (lock) {
|
||||
if (engine == null) {
|
||||
engine = new MultiThreadedPOWEngine();
|
||||
}
|
||||
}
|
||||
notification = new ProofOfWorkNotification(this);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user