Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VLC-Android
Manage
Activity
Members
Labels
Plan
Issues
528
Issue boards
Milestones
Wiki
Code
Merge requests
14
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
670d3a4d
Commit
670d3a4d
authored
6 years ago
by
Geoffrey Métais
Browse files
Options
Downloads
Patches
Plain Diff
Context sheet for extensions
parent
0c9f7d1a
No related branches found
Branches containing commit
No related tags found
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/browser/ExtensionBrowser.java
+18
-40
18 additions, 40 deletions
...id/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
vlc-android/src/org/videolan/vlc/util/Constants.java
+2
-1
2 additions, 1 deletion
vlc-android/src/org/videolan/vlc/util/Constants.java
with
20 additions
and
41 deletions
vlc-android/src/org/videolan/vlc/gui/browser/ExtensionBrowser.java
+
18
−
40
View file @
670d3a4d
package
org.videolan.vlc.gui.browser
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.Handler
;
...
...
@@ -10,9 +9,7 @@ import android.support.v4.app.Fragment;
import
android.support.v4.app.FragmentActivity
;
import
android.support.v7.app.AppCompatActivity
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.view.ContextMenu
;
import
android.view.LayoutInflater
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.TextView
;
...
...
@@ -23,15 +20,18 @@ import org.videolan.vlc.extensions.ExtensionListing;
import
org.videolan.vlc.extensions.ExtensionManagerService
;
import
org.videolan.vlc.extensions.Utils
;
import
org.videolan.vlc.extensions.api.VLCExtensionItem
;
import
org.videolan.vlc.gui.dialogs.ContextSheetKt
;
import
org.videolan.vlc.gui.dialogs.CtxActionReceiver
;
import
org.videolan.vlc.gui.view.ContextMenuRecyclerView
;
import
org.videolan.vlc.gui.view.SwipeRefreshLayout
;
import
org.videolan.vlc.media.MediaUtils
;
import
org.videolan.vlc.util.Constants
;
import
org.videolan.vlc.util.WeakHandler
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
ExtensionBrowser
extends
Fragment
implements
View
.
OnClickListener
,
android
.
support
.
v4
.
widget
.
SwipeRefreshLayout
.
OnRefreshListener
{
public
class
ExtensionBrowser
extends
Fragment
implements
View
.
OnClickListener
,
android
.
support
.
v4
.
widget
.
SwipeRefreshLayout
.
OnRefreshListener
,
CtxActionReceiver
{
public
static
final
String
TAG
=
"VLC/ExtensionBrowser"
;
...
...
@@ -159,9 +159,8 @@ public class ExtensionBrowser extends Fragment implements View.OnClickListener,
@Override
public
void
onClick
(
View
v
)
{
if
(
v
.
getId
()
==
mAddDirectoryFAB
.
getId
()){
ExtensionListing
extension
=
mExtensionManagerService
.
getCurrentExtension
();
if
(
extension
==
null
)
return
;
final
ExtensionListing
extension
=
mExtensionManagerService
.
getCurrentExtension
();
if
(
extension
==
null
)
return
;
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
);
intent
.
setComponent
(
extension
.
settingsActivity
());
startActivity
(
intent
);
...
...
@@ -174,53 +173,32 @@ public class ExtensionBrowser extends Fragment implements View.OnClickListener,
mHandler
.
sendEmptyMessageDelayed
(
ACTION_HIDE_REFRESH
,
REFRESH_TIMEOUT
);
}
@Override
public
void
onCreateContextMenu
(
ContextMenu
menu
,
View
v
,
ContextMenu
.
ContextMenuInfo
menuInfo
)
{
if
(
menuInfo
==
null
)
return
;
ContextMenuRecyclerView
.
RecyclerContextMenuInfo
info
=
(
ContextMenuRecyclerView
.
RecyclerContextMenuInfo
)
menuInfo
;
VLCExtensionItem
item
=
mAdapter
.
getItem
(
info
.
position
);
if
(
item
.
type
==
VLCExtensionItem
.
TYPE_DIRECTORY
)
return
;
boolean
isVideo
=
item
.
type
==
VLCExtensionItem
.
TYPE_VIDEO
;
getActivity
().
getMenuInflater
().
inflate
(
R
.
menu
.
extension_context_menu
,
menu
);
menu
.
findItem
(
R
.
id
.
extension_item_view_play_audio
).
setVisible
(
isVideo
);
}
@Override
public
boolean
onContextItemSelected
(
MenuItem
item
)
{
ContextMenuRecyclerView
.
RecyclerContextMenuInfo
info
=
(
ContextMenuRecyclerView
.
RecyclerContextMenuInfo
)
item
.
getMenuInfo
();
return
info
!=
null
&&
handleContextItemSelected
(
item
,
info
.
position
);
}
public
void
openContextMenu
(
final
int
position
)
{
mRecyclerView
.
openContextMenu
(
position
);
ContextSheetKt
.
showContext
(
requireActivity
(),
this
,
position
,
mAdapter
.
getItem
(
position
).
title
,
Constants
.
CTX_PLAY_ALL
|
Constants
.
CTX_APPEND
|
Constants
.
CTX_PLAY_AS_AUDIO
|
Constants
.
CTX_ITEM_DL
);
}
protected
boolean
handleContextItemSelected
(
MenuItem
item
,
final
int
position
)
{
switch
(
item
.
getItemId
())
{
case
R
.
id
.
extension_item_view_play_all
:
@Override
public
void
onCtxAction
(
int
position
,
int
option
)
{
switch
(
option
)
{
case
Constants
.
CTX_PLAY_ALL
:
List
<
VLCExtensionItem
>
items
=
mAdapter
.
getAll
();
List
<
MediaWrapper
>
medias
=
new
ArrayList
<>(
items
.
size
());
for
(
VLCExtensionItem
vlcItem
:
items
)
{
medias
.
add
(
Utils
.
mediawrapperFromExtension
(
vlcItem
));
}
MediaUtils
.
openList
(
getActivity
(),
medias
,
position
);
return
true
;
case
R
.
id
.
extension_item_view_append
:
break
;
case
Constants
.
CTX_APPEND
:
MediaUtils
.
appendMedia
(
getActivity
(),
Utils
.
mediawrapperFromExtension
(
mAdapter
.
getItem
(
position
)));
return
true
;
case
R
.
id
.
extension_item_view_play_audio
:
break
;
case
Constants
.
CTX_PLAY_AS_AUDIO
:
MediaWrapper
mw
=
Utils
.
mediawrapperFromExtension
(
mAdapter
.
getItem
(
position
));
mw
.
addFlags
(
MediaWrapper
.
MEDIA_FORCE_AUDIO
);
MediaUtils
.
openMedia
(
getActivity
(),
mw
);
return
true
;
case
R
.
id
.
extension_item_download
:
break
;
case
Constants
.
CTX_ITEM_DL
:
//TODO
default
:
return
false
;
break
;
}
}
...
...
This diff is collapsed.
Click to expand it.
vlc-android/src/org/videolan/vlc/util/Constants.java
+
2
−
1
View file @
670d3a4d
...
...
@@ -143,7 +143,8 @@ public class Constants {
public
final
static
int
CTX_NETWORK_ADD
=
1
<<
12
;
public
final
static
int
CTX_NETWORK_EDIT
=
1
<<
13
;
public
final
static
int
CTX_NETWORK_REMOVE
=
1
<<
14
;
public
final
static
int
CTX_CUSTOM_REMOVE
=
1
<<
15
;
public
final
static
int
CTX_CUSTOM_REMOVE
=
1
<<
15
;
public
final
static
int
CTX_ITEM_DL
=
1
<<
16
;
public
final
static
int
CTX_VIDEO_FLAGS
=
Constants
.
CTX_APPEND
|
Constants
.
CTX_DELETE
|
Constants
.
CTX_DOWNLOAD_SUBTITLES
|
Constants
.
CTX_INFORMATION
|
Constants
.
CTX_PLAY_ALL
|
Constants
.
CTX_PLAY_AS_AUDIO
;
public
final
static
int
CTX_TRACK_FLAGS
=
Constants
.
CTX_APPEND
|
Constants
.
CTX_PLAY_NEXT
|
Constants
.
CTX_DELETE
|
Constants
.
CTX_INFORMATION
|
Constants
.
CTX_PLAY_ALL
|
Constants
.
CTX_ADD_TO_PLAYLIST
|
Constants
.
CTX_SET_RINGTONE
;
...
...
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