2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 21:27:40 +00:00

Extend EntryItem

Makes it possible to use a subtitle in it, if provided.

Reviewed by Albert Vaca
This commit is contained in:
Aleix Pol 2015-09-12 12:23:30 +02:00
parent a54c0ac4bd
commit 56d6cffb71
2 changed files with 17 additions and 2 deletions

View File

@ -29,8 +29,8 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:textColor="#CC2222"
android:visibility="gone"
android:textColor="@android:color/darker_gray"
android:text="" />

View File

@ -29,9 +29,16 @@ import org.kde.kdeconnect_tp.R;
public class EntryItem implements ListAdapter.Item {
private final String title;
private final String subtitle;
public EntryItem(String title) {
public EntryItem(String title) {
this.title = title;
this.subtitle = null;
}
public EntryItem(String title, String subtitle) {
this.title = title;
this.subtitle = subtitle;
}
@Override
@ -41,6 +48,14 @@ public class EntryItem implements ListAdapter.Item {
TextView titleView = (TextView)v.findViewById(R.id.list_item_entry_title);
if (titleView != null) titleView.setText(title);
if (subtitle != null) {
TextView subtitleView = (TextView) v.findViewById(R.id.list_item_entry_summary);
if (subtitleView != null) {
subtitleView.setVisibility(View.VISIBLE);
subtitleView.setText(subtitle);
}
}
return v;
}