better formatting for tasks

This commit is contained in:
Phillip Thelen 2015-11-24 21:21:32 +01:00
parent dba6030c25
commit 933c9cd515
5 changed files with 16 additions and 7 deletions

View file

@ -64,7 +64,7 @@
android:layout_height="wrap_content"
android:text="@{daily.text}" />
<TextView
android:id="@+id/textView6"
android:id="@+id/notesTextView"
style="@style/CardText"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -66,7 +66,7 @@
android:text="@{habit.text}" />
<TextView
android:id="@+id/textView6"
android:id="@+id/notesTextView"
style="@style/CardText"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View file

@ -63,7 +63,7 @@
android:text="@{reward.text}" />
<TextView
android:id="@+id/textView6"
android:id="@+id/notesTextView"
style="@style/CardText"
android:layout_width="wrap_content"
android:layout_height="41dp"

View file

@ -54,7 +54,7 @@
android:text="@{todo.text}" />
<TextView
android:id="@+id/textView6"
android:id="@+id/notesTextView"
style="@style/CardText"
android:layout_width="match_parent"
android:layout_height="match_parent"

View file

@ -176,9 +176,10 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
@Override
public long getItemId(int position) {
Task task = filteredObservableContent.get(position);
UUID uuid = new UUID(0, 0).fromString(task.getId());
return uuid.getMostSignificantBits();
if (task.getId() != null && task.getId().length() == 36) {
return UUID.fromString(task.getId()).getMostSignificantBits();
}
return UUID.randomUUID().getMostSignificantBits();
}
@Override
@ -248,6 +249,9 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
public THabitItem Item;
@InjectView(R.id.notesTextView)
TextView notesTextView;
public ViewHolder(View itemView) {
super(itemView);
@ -265,6 +269,11 @@ public class HabitItemRecyclerViewAdapter<THabitItem extends Task>
public void bindHolder(THabitItem habitItem, int position) {
double itemvalue = habitItem.getValue();
Item = habitItem;
if (habitItem.notes.length() == 0) {
notesTextView.setHeight(0);
} else {
notesTextView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
}
}
@Override