Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Ewout ter Hoeven
VLC-Android
Commits
cc91cf19
Commit
cc91cf19
authored
May 20, 2015
by
Geoffrey Métais
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore correct delete dialogs
parent
3cb4ef6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
20 deletions
+44
-20
vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
.../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+44
-20
No files found.
vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
View file @
cc91cf19
...
...
@@ -42,8 +42,6 @@ import android.widget.AbsListView;
import
android.widget.AdapterView
;
import
android.widget.AdapterView.AdapterContextMenuInfo
;
import
android.widget.AdapterView.OnItemClickListener
;
import
android.widget.ExpandableListView
;
import
android.widget.ExpandableListView.ExpandableListContextMenuInfo
;
import
android.widget.ImageView
;
import
android.widget.ListView
;
import
android.widget.PopupMenu
;
...
...
@@ -88,6 +86,7 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
private
MediaLibrary
mMediaLibrary
;
private
MediaBrowser
mMediaBrowser
;
private
MainActivity
mMainActivity
;
private
AlertDialog
mAlertDialog
;
List
<
MediaWrapper
>
mAudioList
;
private
AudioBrowserListAdapter
mArtistsAdapter
;
...
...
@@ -235,6 +234,9 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
mMediaBrowser
.
release
();
mMediaBrowser
=
null
;
}
if
(
mAlertDialog
!=
null
&&
mAlertDialog
.
isShowing
())
mAlertDialog
.
dismiss
();
}
@Override
...
...
@@ -427,25 +429,47 @@ public class AudioBrowserFragment extends MediaBrowserFragment implements SwipeR
List
<
MediaWrapper
>
mediaList
=
adapter
.
getMedias
(
position
);
if
(
adapter
.
getCount
()
<=
position
||
mediaList
==
null
||
mediaList
.
isEmpty
())
return
false
;
AlertDialog
alertDialog
=
CommonDialogs
.
deletePlaylist
(
getActivity
(),
adapter
.
getItem
(
position
).
mTitle
,
new
VLCRunnable
(
adapter
.
getItem
(
position
))
{
@Override
public
void
run
(
Object
o
)
{
AudioBrowserListAdapter
.
ListItem
listItem
=
(
AudioBrowserListAdapter
.
ListItem
)
o
;
if
(!
MediaDatabase
.
getInstance
().
playlistExists
(
listItem
.
mTitle
))
{
MediaWrapper
media
=
listItem
.
mMediaList
.
get
(
0
);
mMediaLibrary
.
getMediaItems
().
remove
(
media
);
if
(
mAudioController
.
getMediaLocations
().
contains
(
media
.
getLocation
()))
mAudioController
.
removeLocation
(
media
.
getLocation
());
}
else
{
MediaDatabase
.
getInstance
().
playlistDelete
(
listItem
.
mTitle
);
if
(
mode
==
MODE_PLAYLIST
)
{
mAlertDialog
=
CommonDialogs
.
deletePlaylist
(
getActivity
(),
adapter
.
getItem
(
position
).
mTitle
,
new
VLCRunnable
(
adapter
.
getItem
(
position
))
{
@Override
public
void
run
(
Object
o
)
{
AudioBrowserListAdapter
.
ListItem
listItem
=
(
AudioBrowserListAdapter
.
ListItem
)
o
;
if
(!
MediaDatabase
.
getInstance
().
playlistExists
(
listItem
.
mTitle
))
{
MediaWrapper
media
=
listItem
.
mMediaList
.
get
(
0
);
mMediaLibrary
.
getMediaItems
().
remove
(
media
);
if
(
mAudioController
.
getMediaLocations
().
contains
(
media
.
getLocation
()))
mAudioController
.
removeLocation
(
media
.
getLocation
());
}
else
{
MediaDatabase
.
getInstance
().
playlistDelete
(
listItem
.
mTitle
);
}
updateLists
();
}
});
}
else
{
mAlertDialog
=
CommonDialogs
.
deleteMedia
(
getActivity
(),
adapter
.
getItem
(
position
).
mMediaList
.
get
(
0
).
getLocation
(),
adapter
.
getItem
(
position
).
mTitle
,
new
VLCRunnable
(
adapter
.
getItem
(
position
))
{
@Override
public
void
run
(
Object
o
)
{
AudioBrowserListAdapter
.
ListItem
listItem
=
(
AudioBrowserListAdapter
.
ListItem
)
o
;
if
(!
MediaDatabase
.
getInstance
().
playlistExists
(
listItem
.
mTitle
))
{
MediaWrapper
media
=
listItem
.
mMediaList
.
get
(
0
);
mMediaLibrary
.
getMediaItems
().
remove
(
media
);
if
(
mAudioController
.
getMediaLocations
().
contains
(
media
.
getLocation
()))
mAudioController
.
removeLocation
(
media
.
getLocation
());
}
else
{
MediaDatabase
.
getInstance
().
playlistDelete
(
listItem
.
mTitle
);
}
updateLists
();
}
updateLists
();
}
});
alertDialog
.
show
();
});
}
mAlertDialog
.
show
();
return
true
;
}
...
...
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