[Android] Allow 'internal storage' to be removed
Geoffrey Métais
git at videolan.org
Tue May 12 14:40:51 CEST 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon May 11 15:17:54 2015 +0200| [7ba515192151b6386a2812d5c19eb8a698e70857] | committer: Geoffrey Métais
Allow 'internal storage' to be removed
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=7ba515192151b6386a2812d5c19eb8a698e70857
---
.../vlc/gui/browser/BaseBrowserAdapter.java | 74 +++++++++-----------
1 file changed, 35 insertions(+), 39 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
index 194ddd0..c2b643a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserAdapter.java
@@ -178,49 +178,45 @@ public class BaseBrowserAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
fragment.browse(mw, holder.getAdapterPosition());
}
});
- vh.checkBox.setChecked(isPublicStorage ||
- mMediaDirsLocation == null || mMediaDirsLocation.isEmpty() ||
+ vh.checkBox.setChecked(mMediaDirsLocation == null || mMediaDirsLocation.isEmpty() ||
mMediaDirsLocation.contains(storage.getPath()));
- if (!isPublicStorage) {
- vh.checkBox.setEnabled(true);
- vh.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ vh.checkBox.setEnabled(true);
+ vh.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
+ String path = ((Storage)getItem(vh.getAdapterPosition())).getPath();
+ updateMediaDirs();
+ if (isChecked) {
+ addDir(path);
+ } else {
+ if (mMediaDirsLocation == null || mMediaDirsLocation.isEmpty()){
+ String storagePath;
+ for (Object storage : mMediaList){
+ storagePath = ((Storage)storage).getPath();
+ if (!TextUtils.equals(storagePath, path))
+ mDbManager.addDir(storagePath);
+ }
+ } else
+ mDbManager.removeDir(path);
+ }
+ fragment.updateLib();
+ }
+ });
+ if (hasContextMenu) {
+ vh.more.setOnClickListener(new View.OnClickListener() {
@Override
- public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
- String path = ((Storage)getItem(vh.getAdapterPosition())).getPath();
- updateMediaDirs();
- if (isChecked) {
- addDir(path);
- } else {
- if (mMediaDirsLocation == null || mMediaDirsLocation.isEmpty()){
- String storagePath;
- for (Object storage : mMediaList){
- storagePath = ((Storage)storage).getPath();
- if (!TextUtils.equals(storagePath, path))
- mDbManager.addDir(storagePath);
- }
- } else
- mDbManager.removeDir(path);
- }
- fragment.updateLib();
+ public void onClick(View v) {
+ fragment.onPopupMenu(vh.more, holder.getAdapterPosition());
}
});
- if (hasContextMenu) {
- vh.more.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- fragment.onPopupMenu(vh.more, holder.getAdapterPosition());
- }
- });
- vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
- @Override
- public boolean onLongClick(View v) {
- fragment.mRecyclerView.openContextMenu(holder.getAdapterPosition());
- return true;
- }
- });
- }
- } else
- vh.checkBox.setEnabled(false);
+ vh.itemView.setOnLongClickListener(new View.OnLongClickListener() {
+ @Override
+ public boolean onLongClick(View v) {
+ fragment.mRecyclerView.openContextMenu(holder.getAdapterPosition());
+ return true;
+ }
+ });
+ }
}
private void addDir(final String path) {
More information about the Android
mailing list