Commit 0d17d4fd authored by Sébastien Toque's avatar Sébastien Toque

UI: show last position of last video played

parent 6dd85e85
......@@ -81,7 +81,7 @@ public class VideoListActivity extends ListActivity implements ISortable {
SharedPreferences preferences = getSharedPreferences(PreferencesActivity.NAME, Context.MODE_PRIVATE);
String lastPath = preferences.getString("LastMedia", null);
long lastTime = preferences.getLong("LastTime", 0);
mVideoAdapter.setLastMedia(lastTime > 0 ? lastPath : null);
mVideoAdapter.setLastMedia(lastTime, lastPath);
mVideoAdapter.notifyDataSetChanged();
super.onResume();
}
......
......@@ -46,6 +46,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
public final static int SORT_BY_LENGTH = 1;
private int mSortDirection = 1;
private int mSortBy = SORT_BY_TITLE;
private long mLastTime;
private String mLastMRL;
public VideoListAdapter(Context context) {
......@@ -62,8 +63,9 @@ public class VideoListAdapter extends ArrayAdapter<Media>
}
}
public void setLastMedia(String lastMRL) {
mLastMRL = lastMRL;
public void setLastMedia(long lastTime, String lastMRL) {
mLastTime = lastTime;
mLastMRL = lastTime > 0 ? lastMRL : null;
}
public void sortBy(int sortby) {
......@@ -145,9 +147,21 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder.thumbnail.setImageBitmap(thumbnail);
}
holder.title.setTextColor(media.getLocation().equals(mLastMRL) ? 0xFFF48B00 /* ORANGE */ : Color.WHITE);
holder.subtitle.setText(String.format("%s - %dx%d",
Util.millisToString(media.getLength()), media.getWidth(), media.getHeight()));
if (media.getLocation().equals(mLastMRL))
{
holder.title.setTextColor(0xFFF48B00 /* ORANGE */);
holder.subtitle.setText(String.format("%s / %s - %dx%d",
Util.millisToString(mLastTime),
Util.millisToString(media.getLength()),
media.getWidth(), media.getHeight()));
}
else
{
holder.title.setTextColor(Color.WHITE);
holder.subtitle.setText(String.format("%s - %dx%d",
Util.millisToString(media.getLength()),
media.getWidth(), media.getHeight()));
}
holder.more.setTag(media);
holder.more.setOnClickListener(moreClickListener);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment