Merge remote-tracking branch 'remotes/upstream/video_thumbnail' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Sun, 1 Nov 2015 08:14:09 +0000 (09:14 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Sun, 1 Nov 2015 08:14:09 +0000 (09:14 +0100)
1  2 
CHANGELOG.md
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
src/com/owncloud/android/ui/adapter/FileListListAdapter.java
src/com/owncloud/android/ui/fragment/OCFileListFragment.java

diff --cc CHANGELOG.md
@@@ -1,26 -1,42 +1,30 @@@
 -## 1.7.2 (July 2015)
 -- New navigation drawer
 -- Improved Passcode
 -- Automatic grid view just for folders full of images
 -- More characters allowed in file names
 -- Support for servers in same domain, different path
 -- Bugs fixed:
 -  + Frequent crashes in folder with several images
 -  + Sync error in servers with huge quota and external storage enable
 -  + Share by link error 
 -  + Some other crashes and minor bugs
++# 2015-11-01
++- PR [#1236](https://github.com/owncloud/android/pull/1236) "Streaming video/audio" merged
++- PR [#1035](https://github.com/owncloud/android/pull/1035) "Enable video thumbnail" merged
 -## 1.7.1 (April 2015)
 +# 2015-10-31
 +- updated all PR
 +- bugfix: #1234, #1230
 +- implement Crash Handler
 +- implement direct download of latest apk in settings -> last item on bottom
  
 -- Share link even with password enforced by server
 -- Get the app ready for oc 8.1 servers
 -- Added option to create new folder in uploads from external apps
 -- Improved management of deleted users
 -- Bugs fixed
 -  + Fixed crash on Android 2.x devices
 -  + Improvements on uploads
 -
 -## 1.7.0 (February 2015)
 -
 -- Download full folders
 -- Grid view for images
 -- Remote thumbnails (OC Server 8.0+)
 -- Added number of files and folders at the end of the list
 -- "Open with" in contextual menu
 -- Downloads added to Media Provider
 -- Uploads:
 -  + Local thumbnails in section "Files"
 -  + Multiple selection in "Content from other apps" (Android 4.3+)
 -- Gallery: 
 -  + proper handling of EXIF
 -  + obey sorting in the list of files
 -- Settings view updated
 -- Improved subjects in e-mails
 -- Bugs fixed
 +# 2015-10-30
 +- fixed problem with Authority
  
 +# 2015-10-29
 +- PR [#1099](https://github.com/owncloud/android/pull/1099) "Switch list vs grid" merged
 +- PR [#1100](https://github.com/owncloud/android/pull/1100) "Material FAB with speed dial implementation" merged
 +- PR [#1209](https://github.com/owncloud/android/pull/1209) "Material buttons - before in #1090" merged
 +- PR [#1205](https://github.com/owncloud/android/pull/1205) "Switch between online and offline files" merged
 +- PR [#1195](https://github.com/owncloud/android/pull/1195) "Resize Cache" merged
 +- PR [#1187](https://github.com/owncloud/android/pull/1187) "Video: Big thumbnails" merged
 +- PR [#1058](https://github.com/owncloud/android/pull/1058) "add sort to UploadFileActiviy" merged
 +- PR [#1168](https://github.com/owncloud/android/pull/1168) "Avoid duplicate files" merged
 +- PR [#1176](https://github.com/owncloud/android/pull/1176) "Multi select" merged
  
  
 +# 2015-10-26
 +- start of branch
 +- PR [#745](https://github.com/owncloud/android/pull/745) merged
 +- PR [#1044](https://github.com/owncloud/android/pull/1044) merged: < 8.1: GalleryPlus app needed, >= 8.2 Gallery app needed
 +- PR [#1111](https://github.com/owncloud/android/pull/1111) merged
@@@ -36,9 -36,8 +38,11 @@@ import android.graphics.Bitmap
  import android.graphics.Bitmap.CompressFormat;
  import android.graphics.BitmapFactory;
  import android.graphics.Canvas;
 +import android.graphics.Point;
++import android.graphics.Canvas;
+ import android.graphics.Paint;
  import android.graphics.drawable.BitmapDrawable;
 +import android.graphics.drawable.ColorDrawable;
  import android.graphics.drawable.Drawable;
  import android.media.ThumbnailUtils;
  import android.net.Uri;
@@@ -211,15 -178,23 +216,25 @@@ public class ThumbnailsCacheManager 
                  }
  
                  mFile = params[0];
 +                mIsThumbnail = (Boolean) params[1];
 +
                  
                  if (mFile instanceof OCFile) {
 -                    thumbnail = doOCFileInBackground();
 +                    thumbnail = doOCFileInBackground(mIsThumbnail);
+                     if (((OCFile) mFile).isVideo()){
+                         thumbnail = addVideoOverlay(thumbnail);
+                     }
                  }  else if (mFile instanceof File) {
 -                    thumbnail = doFileInBackground();
 +                    thumbnail = doFileInBackground(mIsThumbnail);
-                 } else {
-                     // do nothing
+                     String url = ((File) mFile).getAbsolutePath();
+                     String mMimeType = FileStorageUtils.getMimeTypeFromName(url);
+                     if (mMimeType != null && mMimeType.startsWith("video/")){
+                         thumbnail = addVideoOverlay(thumbnail);
+                     }
+                 //} else {  do nothing
                  }
  
                  }catch(Throwable t){
@@@ -34,7 -30,9 +34,10 @@@ import android.accounts.Account
  import android.content.Context;\r
  import android.content.SharedPreferences;\r
  import android.graphics.Bitmap;\r
 +import android.graphics.Color;\r
+ import android.graphics.BitmapFactory;\r
+ import android.graphics.Canvas;\r
+ import android.graphics.Paint;\r
  import android.os.Build;\r
  import android.preference.PreferenceManager;\r
  import android.text.format.DateUtils;\r
@@@ -345,12 -296,19 +348,18 @@@ public class FileListListAdapter extend
              \r
              // No Folder\r
              if (!file.isFolder()) {\r
-                 if (file.isImage() && file.getRemoteId() != null){\r
+                 if ((file.isImage() || file.isVideo()) && file.getRemoteId() != null){\r
                      // Thumbnail in Cache?\r
                      Bitmap thumbnail = ThumbnailsCacheManager.getBitmapFromDiskCache(\r
 -                            String.valueOf(file.getRemoteId())\r
 -                            );\r
 +                            "t" + String.valueOf(file.getRemoteId()));\r
                      if (thumbnail != null && !file.needsUpdateThumbnail()){\r
-                         fileIcon.setImageBitmap(thumbnail);\r
\r
+                         if (file.isVideo()) {\r
+                             Bitmap withOverlay = ThumbnailsCacheManager.addVideoOverlay(thumbnail);\r
+                             fileIcon.setImageBitmap(withOverlay);\r
+                         } else {\r
+                             fileIcon.setImageBitmap(thumbnail);\r
+                         }\r
                      } else {\r
                          // generate new Thumbnail\r
                          if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {\r
@@@ -760,12 -428,9 +760,12 @@@ public class OCFileListFragment extend
                  if (file.isFolder()) {
                      foldersCount++;
                  } else {
 -                    filesCount++;
 -                    if (file.isImage() || file.isVideo()){
 -                        imagesCount++;
 +                    if (!file.isHidden()) {
 +                        filesCount++;
 +
-                         if (file.isImage()) {
++                        if (file.isImage() || file.isVideo()) {
 +                            imagesCount++;
 +                        }
                      }
                  }
              }
              OwnCloudVersion version = AccountUtils.getServerVersion(
                      ((FileActivity)mContainerActivity).getAccount());
              if (version != null && version.supportsRemoteThumbnails() &&
 -                imagesCount > 0 && imagesCount == filesCount) {
 +                    DisplayUtils.isGridView(mFile, mContainerActivity.getStorageManager())) {
                  switchToGridView();
 +                registerLongClickListener();
              } else {
                  switchToListView();
+ //                switchToGridView();
              }
          }
      }