Fixed NullPointerException and minor improvements

This commit is contained in:
Christian Basler 2015-10-24 20:59:24 +02:00
parent f5bf5c8bca
commit 725089c604
4 changed files with 80 additions and 79 deletions

View File

@ -280,9 +280,11 @@ 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 (messenger != null) {
if (isChecked) {
try {
service.send(Message.obtain(null, MSG_START_NODE));
@ -297,8 +299,8 @@ public class MessageListActivity extends AppCompatActivity
}
}
}
}
})
.withChecked(BitmessageService.isRunning())
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override

View File

@ -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;

View File

@ -91,7 +91,7 @@ public class BitmessageService extends Service {
@Override
public void onDestroy() {
bmc.shutdown();
if (bmc.isRunning()) bmc.shutdown();
running = false;
}

View File

@ -1,82 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
android:fitsSystemWindows="true"
android:orientation="vertical">
<TextView
android:id="@+id/subject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:text="Subject"
android:padding="16dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:elegantTextHeight="false"
android:enabled="false"/>
android:enabled="false"
android:gravity="center_vertical"
android:padding="16dp"
android:text="Subject"
android:textAppearance="?android:attr/textAppearanceLarge" />
<View
android:id="@+id/divider"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_below="@id/subject"
android:background="@color/divider"/>
android:background="@color/divider" />
<ImageView
android:id="@+id/avatar"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@+id/divider"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@color/accent"
android:layout_margin="16dp"/>
android:layout_below="@+id/divider"
android:layout_margin="16dp"
android:src="@color/accent" />
<TextView
android:id="@+id/sender"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="Sender"
android:layout_alignTop="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textStyle="bold"/>
android:text="Sender"
android:textStyle="bold" />
<TextView
android:id="@+id/recipient"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="Recipient"
android:layout_alignBottom="@+id/avatar"
android:layout_toEndOf="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:gravity="center_vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_alignBottom="@+id/avatar"
android:layout_toRightOf="@+id/avatar"
android:layout_toEndOf="@+id/avatar"/>
android:text="Recipient" />
<TextView
android:id="@+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Text"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/avatar"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="32dp"
android:paddingBottom="64dp"
android:layout_below="@+id/avatar"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
android:text="New Text"
android:textIsSelectable="true" />
</RelativeLayout>
</ScrollView>