1
0
mirror of http://galexander.org/git/simplesshd.git synced 2024-11-14 02:59:05 +00:00

now the notification view looks good and has useful information

This commit is contained in:
Greg Alexander 2016-10-17 09:47:36 -04:00
parent 9c7454d222
commit 3ef00eb6a1
2 changed files with 12 additions and 1 deletions

View File

@ -3,10 +3,15 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/notification_text"
<ImageView android:id="@+id/n_icon"
android:layout_width="60dp"
android:layout_height="60dp"
android:scaleType="fitCenter" />
<TextView android:id="@+id/n_text"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical|left"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="SimpleSSHD is running" />
</LinearLayout>

View File

@ -70,6 +70,12 @@ public class SimpleSSHDService extends Service {
n.contentView = new RemoteViews(getPackageName(),
R.layout.notification);
/* for some reason icon cannot be defined in xml: */
n.contentView.setImageViewResource(R.id.n_icon,
R.drawable.icon);
n.contentView.setTextViewText(R.id.n_text,
"SimpleSSHD listening on "+SimpleSSHD.get_ip()+
":"+Prefs.get_port());
startForeground(1, n);
}