Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
534
Issue boards
Milestones
Wiki
Code
Merge requests
13
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VideoLAN
VLC-Android
Commits
157074b0
Commit
157074b0
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Videos grouping: pass context from fragments
(cherry picked from commit
bb3b18ab
)
parent
99de86a8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+5
-2
5 additions, 2 deletions
...oid/src/org/videolan/vlc/gui/video/VideoGridFragment.java
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+5
-15
5 additions, 15 deletions
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
with
10 additions
and
17 deletions
vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.java
+
5
−
2
View file @
157074b0
...
@@ -22,6 +22,7 @@ package org.videolan.vlc.gui.video;
...
@@ -22,6 +22,7 @@ package org.videolan.vlc.gui.video;
import
android.annotation.TargetApi
;
import
android.annotation.TargetApi
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.SharedPreferences
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
...
@@ -341,6 +342,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
...
@@ -341,6 +342,7 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
@MainThread
@MainThread
public
void
updateList
()
{
public
void
updateList
()
{
mHandler
.
sendEmptyMessageDelayed
(
SET_REFRESHING
,
300
);
mHandler
.
sendEmptyMessageDelayed
(
SET_REFRESHING
,
300
);
final
Context
ctx
=
getActivity
();
VLCApplication
.
runBackground
(
new
Runnable
()
{
VLCApplication
.
runBackground
(
new
Runnable
()
{
@Override
@Override
...
@@ -354,8 +356,9 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
...
@@ -354,8 +356,9 @@ public class VideoGridFragment extends SortableFragment<VideoListAdapter> implem
displayList
.
add
(
item
);
displayList
.
add
(
item
);
}
}
}
else
{
}
else
{
for
(
MediaGroup
item
:
MediaGroup
.
group
(
itemList
))
final
SharedPreferences
preferences
=
ctx
!=
null
?
PreferenceManager
.
getDefaultSharedPreferences
(
ctx
)
:
null
;
displayList
.
add
(
item
.
getMedia
());
final
int
minGroupLengthValue
=
preferences
!=
null
?
Integer
.
valueOf
(
preferences
.
getString
(
"video_min_group_length"
,
"6"
))
:
6
;
for
(
MediaGroup
item
:
MediaGroup
.
group
(
itemList
,
minGroupLengthValue
))
displayList
.
add
(
item
.
getMedia
());
}
}
VLCApplication
.
runOnMainThread
(
new
Runnable
()
{
VLCApplication
.
runOnMainThread
(
new
Runnable
()
{
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/media/MediaGroup.java
+
5
−
15
View file @
157074b0
...
@@ -20,11 +20,7 @@
...
@@ -20,11 +20,7 @@
package
org.videolan.vlc.media
;
package
org.videolan.vlc.media
;
import
android.content.SharedPreferences
;
import
android.preference.PreferenceManager
;
import
org.videolan.medialibrary.media.MediaWrapper
;
import
org.videolan.medialibrary.media.MediaWrapper
;
import
org.videolan.vlc.VLCApplication
;
import
org.videolan.vlc.gui.helpers.BitmapUtil
;
import
org.videolan.vlc.gui.helpers.BitmapUtil
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -88,25 +84,19 @@ public class MediaGroup extends MediaWrapper {
...
@@ -88,25 +84,19 @@ public class MediaGroup extends MediaWrapper {
this
.
mTitle
=
title
;
this
.
mTitle
=
title
;
}
}
public
static
List
<
MediaGroup
>
group
(
MediaWrapper
[]
mediaList
)
{
public
static
List
<
MediaGroup
>
group
(
MediaWrapper
[]
mediaList
,
int
minGroupLengthValue
)
{
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
for
(
MediaWrapper
media
:
mediaList
)
for
(
MediaWrapper
media
:
mediaList
)
if
(
media
!=
null
)
insertInto
(
groups
,
media
,
minGroupLengthValue
);
if
(
media
!=
null
)
insertInto
(
groups
,
media
);
return
groups
;
return
groups
;
}
}
public
static
List
<
MediaGroup
>
group
(
List
<
MediaWrapper
>
mediaList
)
{
public
static
List
<
MediaGroup
>
group
(
List
<
MediaWrapper
>
mediaList
,
int
minGroupLengthValue
)
{
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
final
ArrayList
<
MediaGroup
>
groups
=
new
ArrayList
<>();
for
(
MediaWrapper
media
:
mediaList
)
for
(
MediaWrapper
media
:
mediaList
)
if
(
media
!=
null
)
insertInto
(
groups
,
media
,
minGroupLengthValue
);
if
(
media
!=
null
)
insertInto
(
groups
,
media
);
return
groups
;
return
groups
;
}
}
private
static
void
insertInto
(
ArrayList
<
MediaGroup
>
groups
,
MediaWrapper
media
)
{
private
static
void
insertInto
(
ArrayList
<
MediaGroup
>
groups
,
MediaWrapper
media
,
int
minGroupLengthValue
)
{
final
SharedPreferences
preferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
VLCApplication
.
getAppContext
());
final
int
minGroupLengthValue
=
Integer
.
valueOf
(
preferences
.
getString
(
"video_min_group_length"
,
"6"
));
for
(
MediaGroup
mediaGroup
:
groups
)
{
for
(
MediaGroup
mediaGroup
:
groups
)
{
final
String
group
=
mediaGroup
.
getTitle
().
toLowerCase
();
final
String
group
=
mediaGroup
.
getTitle
().
toLowerCase
();
String
title
=
media
.
getTitle
().
toLowerCase
();
String
title
=
media
.
getTitle
().
toLowerCase
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment