Fixed NullPointerException and minor improvements
This commit is contained in:
@ -280,25 +280,27 @@ public class MessageListActivity extends AppCompatActivity
|
||||
new SwitchDrawerItem()
|
||||
.withName(R.string.full_node)
|
||||
.withIcon(CommunityMaterial.Icon.cmd_cloud_outline)
|
||||
.withChecked(BitmessageService.isRunning())
|
||||
.withOnCheckedChangeListener(new OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(IDrawerItem drawerItem, CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
try {
|
||||
service.send(Message.obtain(null, MSG_START_NODE));
|
||||
} catch (RemoteException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
service.send(Message.obtain(null, MSG_STOP_NODE));
|
||||
} catch (RemoteException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
if (messenger != null) {
|
||||
if (isChecked) {
|
||||
try {
|
||||
service.send(Message.obtain(null, MSG_START_NODE));
|
||||
} catch (RemoteException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
service.send(Message.obtain(null, MSG_STOP_NODE));
|
||||
} catch (RemoteException e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.withChecked(BitmessageService.isRunning())
|
||||
)
|
||||
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
|
||||
@Override
|
||||
|
@ -1,6 +1,5 @@
|
||||
package ch.dissem.apps.abit.notification;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
@ -91,7 +91,7 @@ public class BitmessageService extends Service {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
bmc.shutdown();
|
||||
if (bmc.isRunning()) bmc.shutdown();
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user