mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-24 05:46:14 +03:00
Show Modified Date in ListView
This commit is contained in:
parent
76c90085fc
commit
8f0b4572fb
2 changed files with 27 additions and 14 deletions
|
@ -7,6 +7,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import it.niedermann.owncloud.notes.R;
|
||||
|
@ -14,12 +15,9 @@ import it.niedermann.owncloud.notes.R;
|
|||
public class NoteAdapter extends ArrayAdapter<Note> {
|
||||
private List<Note> noteList = null;
|
||||
|
||||
// private SparseBooleanArray mSelectedItemsIds;
|
||||
|
||||
public NoteAdapter(Context context,
|
||||
List<Note> noteList) {
|
||||
super(context, android.R.layout.simple_list_item_1, noteList);
|
||||
// mSelectedItemsIds = new SparseBooleanArray();
|
||||
this.noteList = noteList;
|
||||
}
|
||||
|
||||
|
@ -53,16 +51,17 @@ public class NoteAdapter extends ArrayAdapter<Note> {
|
|||
TextView noteTitle = (TextView) v.findViewById(R.id.noteTitle);
|
||||
TextView noteExcerpt = (TextView) v
|
||||
.findViewById(R.id.noteExcerpt);
|
||||
TextView noteModified = (TextView) v.findViewById(R.id.noteModified);
|
||||
|
||||
// check to see if each individual textview is null.
|
||||
// if not, assign some text!
|
||||
if (noteTitle != null) {
|
||||
noteTitle.setText(note.getTitle());
|
||||
}
|
||||
if (noteExcerpt != null) {
|
||||
noteExcerpt.setText(note.getExcerpt());
|
||||
}
|
||||
}
|
||||
Calendar modified = note.getModified();
|
||||
if (modified.get(Calendar.YEAR) == 2015) {
|
||||
noteModified.setText(note.getModified("dd.MM."));
|
||||
} else {
|
||||
noteModified.setText(note.getModified("dd.MM.yyyy"));
|
||||
}
|
||||
}
|
||||
|
||||
// the view must be returned to our activity
|
||||
return v;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/noteItem"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/noteItem"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeight"
|
||||
android:background="@drawable/list_item_background_selector"
|
||||
|
@ -9,15 +9,29 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/noteTitle"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@drawable/list_item_color_selector"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noteModified"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:gravity="center_vertical"
|
||||
android:textColor="@drawable/list_item_color_selector"
|
||||
android:textSize="16sp" />
|
||||
android:textColor="@drawable/list_item_color_selector_low"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/noteExcerpt"
|
||||
|
|
Loading…
Reference in a new issue