Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
VLC-Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
d09f0b18
Commit
d09f0b18
authored
Oct 24, 2014
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cardview for video browsing
parent
37805e59
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
181 additions
and
97 deletions
+181
-97
vlc-android/res/drawable-hdpi/ic_more_vert_grey600_24dp.png
vlc-android/res/drawable-hdpi/ic_more_vert_grey600_24dp.png
+0
-0
vlc-android/res/drawable-mdpi/ic_more_vert_grey600_24dp.png
vlc-android/res/drawable-mdpi/ic_more_vert_grey600_24dp.png
+0
-0
vlc-android/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png
vlc-android/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png
+0
-0
vlc-android/res/layout/video_grid_card.xml
vlc-android/res/layout/video_grid_card.xml
+73
-0
vlc-android/res/layout/video_grid_item.xml
vlc-android/res/layout/video_grid_item.xml
+0
-61
vlc-android/res/layout/video_list_card.xml
vlc-android/res/layout/video_list_card.xml
+73
-0
vlc-android/res/values-land/booleans.xml
vlc-android/res/values-land/booleans.xml
+4
-0
vlc-android/res/values-sw600dp/booleans.xml
vlc-android/res/values-sw600dp/booleans.xml
+4
-0
vlc-android/res/values-sw600dp/dimens.xml
vlc-android/res/values-sw600dp/dimens.xml
+8
-0
vlc-android/res/values/booleans.xml
vlc-android/res/values/booleans.xml
+4
-0
vlc-android/res/values/dimens.xml
vlc-android/res/values/dimens.xml
+6
-0
vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
...oid/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+5
-32
vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
...roid/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+4
-4
No files found.
vlc-android/res/drawable-hdpi/ic_more_vert_grey600_24dp.png
0 → 100644
View file @
d09f0b18
221 Bytes
vlc-android/res/drawable-mdpi/ic_more_vert_grey600_24dp.png
0 → 100644
View file @
d09f0b18
202 Bytes
vlc-android/res/drawable-xhdpi/ic_more_vert_grey600_24dp.png
0 → 100644
View file @
d09f0b18
252 Bytes
vlc-android/res/layout/video_grid_card.xml
0 → 100644
View file @
d09f0b18
<android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:card_view=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/card_view"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
card_view:cardUseCompatPadding=
"true"
card_view:cardElevation=
"1sp"
>
<RelativeLayout
android:id=
"@+id/layout_item"
android:layout_width=
"@dimen/grid_card_width"
android:layout_height=
"@dimen/grid_card_height"
android:gravity=
"center_vertical"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/ml_item_thumbnail"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/grid_card_thumb_height"
android:layout_alignParentTop=
"true"
android:scaleType=
"fitCenter"
/>
<TextView
android:id=
"@+id/ml_item_title"
android:textSize=
"@dimen/grid_card_title_text_size"
android:textColor=
"?attr/list_title"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/ml_item_thumbnail"
android:layout_toLeftOf=
"@+id/item_more"
android:layout_marginTop=
"5dp"
android:ellipsize=
"end"
android:gravity=
"center_horizontal"
android:maxLines=
"2"
/>
<ImageView
android:id=
"@+id/item_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_below=
"@id/ml_item_thumbnail"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"7dp"
android:clickable=
"true"
android:src=
"@drawable/ic_more_vert_grey600_24dp"
/>
<TextView
android:id=
"@+id/ml_item_subtitle"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_marginBottom=
"3dp"
android:gravity=
"center_horizontal"
android:singleLine=
"true"
android:textSize=
"@dimen/grid_card_subtitle_text_size"
android:textColor=
"?attr/list_subtitle"
/>
<ProgressBar
android:id=
"@+id/ml_item_progress"
style=
"@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:focusable=
"false"
android:indeterminate=
"false"
android:maxHeight=
"3dip"
android:minHeight=
"3dip"
android:progressDrawable=
"@drawable/gridview_progressbar"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
vlc-android/res/layout/video_grid_item.xml
deleted
100644 → 0
View file @
37805e59
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/layout_item"
android:layout_width=
"160dip"
android:layout_height=
"150dip"
android:orientation=
"vertical"
android:gravity=
"center_vertical"
>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/ml_item_thumbnail"
android:layout_width=
"160dip"
android:layout_height=
"100dip"
android:scaleType=
"fitCenter"
android:layout_gravity=
"center_horizontal"
/>
<ProgressBar
style=
"@android:style/Widget.ProgressBar.Horizontal"
android:id=
"@+id/ml_item_progress"
android:layout_height=
"wrap_content"
android:layout_width=
"fill_parent"
android:minHeight=
"2dip"
android:maxHeight=
"2dip"
android:progressDrawable=
"@drawable/gridview_progressbar"
android:focusable=
"false"
android:indeterminate=
"false"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/ml_item_title"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:ellipsize=
"end"
android:maxLines=
"2"
android:textSize=
"12sp"
android:textColor=
"?attr/list_title"
/>
<TextView
android:id=
"@+id/ml_item_subtitle"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_horizontal"
android:textSize=
"10sp"
android:textColor=
"?attr/list_subtitle"
/>
</LinearLayout>
<ImageView
android:id=
"@+id/item_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_more"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:clickable=
"true"
/>
</RelativeLayout>
\ No newline at end of file
vlc-android/res/layout/video_list_
item
.xml
→
vlc-android/res/layout/video_list_
card
.xml
View file @
d09f0b18
<?xml version="1.0" encoding="utf-8"?>
<
RelativeLayout
xmlns:
android=
"http://schemas.android.com/apk/res/android
"
<
android.support.v7.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:
card_view=
"http://schemas.android.com/apk/res-auto
"
android:id=
"@+id/layout_item"
android:layout_width=
"
fill
_parent"
android:layout_width=
"
match
_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center_vertical"
>
<LinearLayout
card_view:cardUseCompatPadding=
"true"
card_view:cardElevation=
"1sp"
>
<RelativeLayout
android:id=
"@+id/ml_item_layout_thumbnail"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:orientation=
"vertical"
>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/ml_item_thumbnail"
android:layout_width=
"120dip"
android:layout_height=
"75dip"
android:scaleType=
"fitCenter"
/>
<ProgressBar
style=
"@android:style/Widget.ProgressBar.Horizontal"
android:id=
"@+id/ml_item_progress"
android:layout_height=
"wrap_content"
android:layout_width=
"fill_parent"
android:minHeight=
"2dip"
android:maxHeight=
"2dip"
android:progressDrawable=
"@drawable/gridview_progressbar"
android:focusable=
"false"
android:indeterminate=
"false"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toRightOf=
"@+id/ml_item_layout_thumbnail"
android:layout_centerVertical=
"true"
android:orientation=
"vertical"
>
android:scaleType=
"fitCenter"
android:layout_alignParentLeft=
"true"
/>
<TextView
android:id=
"@+id/ml_item_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_toRightOf=
"@id/ml_item_thumbnail"
android:layout_toLeftOf=
"@+id/item_more"
android:ellipsize=
"end"
android:maxLines=
"2"
android:
textSize=
"17s
p"
android:
paddingLeft=
"12di
p"
android:textColor=
"?attr/list_title"
android:paddingLeft=
"12dip"
/>
android:textSize=
"17sp"
/>
<TextView
android:id=
"@+id/ml_item_subtitle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textSize=
"14sp"
android:layout_below=
"@id/ml_item_title"
android:layout_alignLeft=
"@id/ml_item_title"
android:paddingLeft=
"12dip"
android:textColor=
"?attr/list_subtitle"
android:paddingLeft=
"12dip"
/>
</LinearLayout>
<ImageView
android:id=
"@+id/item_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/ic_more"
android:layout_alignParentBottom=
"true"
android:layout_alignParentRight=
"true"
android:clickable=
"true"
/>
<View
android:layout_width=
"wrap_content"
android:layout_height=
"1dp"
android:layout_below=
"@+id/ml_item_layout_thumbnail"
android:background=
"?attr/item_footer"
/>
</RelativeLayout>
\ No newline at end of file
android:textSize=
"14sp"
/>
<ProgressBar
android:id=
"@+id/ml_item_progress"
style=
"@android:style/Widget.ProgressBar.Horizontal"
android:layout_width=
"fill_parent"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_toRightOf=
"@id/ml_item_thumbnail"
android:layout_marginRight=
"20dip"
android:layout_marginLeft=
"10dip"
android:paddingBottom=
"3dip"
android:focusable=
"false"
android:indeterminate=
"false"
android:maxHeight=
"3dip"
android:minHeight=
"3dip"
android:progressDrawable=
"@drawable/gridview_progressbar"
/>
<ImageView
android:id=
"@+id/item_more"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentTop=
"true"
android:layout_marginTop=
"10dip"
android:layout_alignParentRight=
"true"
android:clickable=
"true"
android:src=
"@drawable/ic_more_vert_grey600_24dp"
/>
</RelativeLayout>
</android.support.v7.widget.CardView>
\ No newline at end of file
vlc-android/res/values-land/booleans.xml
0 → 100644
View file @
d09f0b18
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool
name=
"list_mode"
>
false
</bool>
</resources>
\ No newline at end of file
vlc-android/res/values-sw600dp/booleans.xml
0 → 100644
View file @
d09f0b18
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool
name=
"list_mode"
>
false
</bool>
</resources>
\ No newline at end of file
vlc-android/res/values-sw600dp/dimens.xml
0 → 100644
View file @
d09f0b18
<resources>
<dimen
name=
"grid_card_width"
>
200dp
</dimen>
<dimen
name=
"grid_card_height"
>
200dp
</dimen>
<dimen
name=
"grid_card_thumb_height"
>
120dp
</dimen>
<dimen
name=
"grid_card_title_text_size"
>
16sp
</dimen>
<dimen
name=
"grid_card_subtitle_text_size"
>
12sp
</dimen>
<dimen
name=
"grid_card_vertical_spacing"
>
10dp
</dimen>
</resources>
\ No newline at end of file
vlc-android/res/values/booleans.xml
0 → 100644
View file @
d09f0b18
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool
name=
"list_mode"
>
true
</bool>
</resources>
\ No newline at end of file
vlc-android/res/values/dimens.xml
View file @
d09f0b18
...
...
@@ -3,4 +3,10 @@
<dimen
name=
"widget_margin"
>
10dp
</dimen>
<dimen
name=
"audio_browser_item_size"
>
50dp
</dimen>
<dimen
name=
"listview_bottom_padding"
>
50dp
</dimen>
<dimen
name=
"grid_card_width"
>
160dp
</dimen>
<dimen
name=
"grid_card_height"
>
160dp
</dimen>
<dimen
name=
"grid_card_thumb_height"
>
100dp
</dimen>
<dimen
name=
"grid_card_title_text_size"
>
12sp
</dimen>
<dimen
name=
"grid_card_subtitle_text_size"
>
10sp
</dimen>
<dimen
name=
"grid_card_vertical_spacing"
>
0dp
</dimen>
</resources>
\ No newline at end of file
vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
View file @
d09f0b18
...
...
@@ -50,6 +50,7 @@ import android.content.Context;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.content.res.Configuration
;
import
android.content.res.Resources
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
...
...
@@ -81,14 +82,7 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
protected
static
final
String
ACTION_SCAN_STOP
=
"org.videolan.vlc.gui.ScanStop"
;
protected
static
final
int
UPDATE_ITEM
=
0
;
/* Constants used to switch from Grid to List and vice versa */
//FIXME If you know a way to do this in pure XML please do it!
private
static
final
int
GRID_ITEM_WIDTH_DP
=
156
;
private
static
final
int
GRID_HORIZONTAL_SPACING_DP
=
20
;
private
static
final
int
GRID_VERTICAL_SPACING_DP
=
20
;
private
static
final
int
GRID_STRETCH_MODE
=
GridView
.
STRETCH_COLUMN_WIDTH
;
private
static
final
int
LIST_HORIZONTAL_SPACING_DP
=
0
;
private
static
final
int
LIST_VERTICAL_SPACING_DP
=
10
;
private
static
final
int
LIST_STRETCH_MODE
=
GridView
.
STRETCH_COLUMN_WIDTH
;
protected
LinearLayout
mLayoutFlipperLoading
;
...
...
@@ -207,29 +201,13 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
mVideoAdapter
.
clear
();
}
private
boolean
hasSpaceForGrid
(
View
v
)
{
final
Activity
activity
=
getActivity
();
if
(
activity
==
null
)
return
true
;
DisplayMetrics
outMetrics
=
new
DisplayMetrics
();
activity
.
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
outMetrics
);
final
int
itemWidth
=
Util
.
convertDpToPx
(
GRID_ITEM_WIDTH_DP
);
final
int
horizontalspacing
=
Util
.
convertDpToPx
(
GRID_HORIZONTAL_SPACING_DP
);
final
int
width
=
mGridView
.
getPaddingLeft
()
+
mGridView
.
getPaddingRight
()
+
horizontalspacing
+
(
itemWidth
*
2
);
if
(
width
<
outMetrics
.
widthPixels
)
return
true
;
return
false
;
}
private
void
updateViewMode
()
{
if
(
getView
()
==
null
||
getActivity
()
==
null
)
{
Log
.
w
(
TAG
,
"Unable to setup the view"
);
return
;
}
Resources
res
=
getResources
();
// Compute the left/right padding dynamically
DisplayMetrics
outMetrics
=
new
DisplayMetrics
();
getActivity
().
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
outMetrics
);
...
...
@@ -239,20 +217,15 @@ public class VideoGridFragment extends SherlockGridFragment implements ISortable
sidePadding
,
mGridView
.
getPaddingBottom
());
// Select between grid or list
if
(
hasSpaceForGrid
(
getView
()))
{
Log
.
d
(
TAG
,
"Switching to grid mode"
);
if
(!
res
.
getBoolean
(
R
.
bool
.
list_mode
))
{
mGridView
.
setNumColumns
(
GridView
.
AUTO_FIT
);
mGridView
.
setStretchMode
(
GRID_STRETCH_MODE
);
mGridView
.
setHorizontalSpacing
(
Util
.
convertDpToPx
(
GRID_HORIZONTAL_SPACING_DP
));
mGridView
.
setVerticalSpacing
(
Util
.
convertDpToPx
(
GRID_VERTICAL_SPACING_DP
));
mGridView
.
setColumnWidth
(
Util
.
convertDpToPx
(
GRID_ITEM_WIDTH_DP
));
mGridView
.
setColumnWidth
(
res
.
getDimensionPixelSize
(
R
.
dimen
.
grid_card_width
));
mGridView
.
setVerticalSpacing
(
res
.
getDimensionPixelSize
(
R
.
dimen
.
grid_card_vertical_spacing
));
mVideoAdapter
.
setListMode
(
false
);
}
else
{
Log
.
d
(
TAG
,
"Switching to list mode"
);
mGridView
.
setNumColumns
(
1
);
mGridView
.
setStretchMode
(
LIST_STRETCH_MODE
);
mGridView
.
setHorizontalSpacing
(
LIST_HORIZONTAL_SPACING_DP
);
mGridView
.
setVerticalSpacing
(
Util
.
convertDpToPx
(
LIST_VERTICAL_SPACING_DP
));
mVideoAdapter
.
setListMode
(
true
);
}
}
...
...
vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
View file @
d09f0b18
...
...
@@ -139,9 +139,9 @@ public class VideoListAdapter extends ArrayAdapter<Media>
LayoutInflater
inflater
=
(
LayoutInflater
)
getContext
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
if
(!
mListMode
)
v
=
inflater
.
inflate
(
R
.
layout
.
video_grid_
item
,
parent
,
false
);
v
=
inflater
.
inflate
(
R
.
layout
.
video_grid_
card
,
parent
,
false
);
else
v
=
inflater
.
inflate
(
R
.
layout
.
video_list_
item
,
parent
,
false
);
v
=
inflater
.
inflate
(
R
.
layout
.
video_list_
card
,
parent
,
false
);
holder
=
new
ViewHolder
();
holder
.
layout
=
v
.
findViewById
(
R
.
id
.
layout_item
);
...
...
@@ -203,7 +203,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder
.
subtitle
.
setText
(
text
);
holder
.
title
.
setText
(
media
.
getTitle
()
+
"\u2026"
);
// ellipsis
holder
.
more
.
setVisibility
(
View
.
INVISIBLE
);
holder
.
progress
.
setVisibility
(
View
.
GON
E
);
holder
.
progress
.
setVisibility
(
View
.
INVISIBL
E
);
}
private
void
fillVideoView
(
ViewHolder
holder
,
Media
media
)
{
...
...
@@ -219,7 +219,7 @@ public class VideoListAdapter extends ArrayAdapter<Media>
holder
.
progress
.
setProgress
((
int
)
(
lastTime
/
1000
));
}
else
{
text
=
Strings
.
millisToText
(
media
.
getLength
());
holder
.
progress
.
setVisibility
(
View
.
GON
E
);
holder
.
progress
.
setVisibility
(
View
.
INVISIBL
E
);
}
if
(
media
.
getWidth
()
>
0
&&
media
.
getHeight
()
>
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment