Merge remote-tracking branch 'remotes/upstream/resizeCache' into beta
authortobiasKaminsky <tobias@kaminsky.me>
Thu, 29 Oct 2015 17:37:28 +0000 (18:37 +0100)
committertobiasKaminsky <tobias@kaminsky.me>
Thu, 29 Oct 2015 17:37:28 +0000 (18:37 +0100)
1  2 
CHANGELOG.md
res/values/strings.xml
res/xml/preferences.xml
src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
src/com/owncloud/android/ui/activity/Preferences.java
src/com/owncloud/android/ui/adapter/DiskLruImageCache.java

diff --cc CHANGELOG.md
@@@ -1,12 -1,60 +1,13 @@@
 -## 1.8.0 (September 2015)
 -- New MATERIAL DESIGN theme
 -- Updated FILE TYPE ICONS
 -- Preview TXT files within the app
 -- COPY files & folders
 -- Preview the full file/folder name from the long press menu
 -- Set a file as FAVORITE (kept-in-sync) from the CONTEXT MENU
 -- Updated CONFLICT RESOLUTION dialog (wording)
 -- Updated background for images with TRANSPARENCY in GALLERY
 -- Hidden files will not enforce list view instead of GRID VIEW (folders from Picasa & others)
 -- Security:
 -  + Updated network stack with security fixes (Jackrabbit 2.10.1)
 -- Bugs fixed:
 -  + Fixed crash when ETag is lost
 -  + Passcode creation not restarted on device rotation
 -  + Recovered share icon shown on folders 'shared with me'
 -  + User name added to subject when sending a share link through e-mail (fixed on SAMLed apps)
 -
 -## 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
 -
 -## 1.7.1 (April 2015)
 -
 -- 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-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
 +
 +
 +# 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
      <string name="file_list__footer__files">%1$d files</string>
      <string name="file_list__footer__files_and_folder">%1$d files, 1 folder</string>
      <string name="file_list__footer__files_and_folders">%1$d files, %2$d folders</string>
 +    <string name="action_switch_grid_view">Switch to grid view</string>
 +    <string name="action_switch_list_view">Switch to list view</string>
+     <string name="common_category">Common</string>
+     <string name="pref_cache_size">Cache size</string>
  </resources>
                <Preference             android:key="log_history"
                                android:title="@string/prefs_log_title_history"
                                android:summary="@string/prefs_log_summary_history"/ -->
-               <Preference android:title="@string/prefs_help" android:key="help" />
-               <Preference android:title="@string/prefs_recommend" android:key="recommend" />
-               <Preference android:title="@string/prefs_feedback" android:key="feedback" />
-               <Preference android:title="@string/prefs_imprint" android:key="imprint" />
+                         
+     </PreferenceCategory>
+       <PreferenceCategory android:title="@string/common_category" android:key="common_category">
+               <EditTextPreference android:title="@string/pref_cache_size"
+                                                       android:key="pref_cache_size"
+                                                       android:digits="0123456789"/>
+       </PreferenceCategory>
  
-               <Preference             android:id="@+id/about_app"
-                       android:title="@string/about_title"
-                       android:key="about_app" />
+       <PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
+     <Preference android:title="@string/prefs_help" android:key="help" />
+     <Preference android:title="@string/prefs_recommend" android:key="recommend" />
+     <Preference android:title="@string/prefs_feedback" android:key="feedback" />
+     <Preference android:title="@string/prefs_imprint" android:key="imprint" />
+                         
+       <Preference             android:id="@+id/about_app" 
+                                       android:title="@string/about_title" 
+                                       android:key="about_app" />
        </PreferenceCategory>
 -    
 +
  
  </PreferenceScreen>
@@@ -147,14 -140,35 +147,36 @@@ public class ThumbnailsCacheManager 
          return null;
      }
  
+     /**
+      * Sets max size of cache
+      * @param maxSize in MB
+      * @return
+      */
+     public static boolean setMaxSize(long maxSize){
+         if (mThumbnailCache != null){
+             mThumbnailCache.setMaxSize(maxSize * 1024 * 1024);
+             return true;
+         } else {
+             return false;
+         }
+     }
+     public static long getMaxSize(){
+         if (mThumbnailCache != null) {
+             return mThumbnailCache.getMaxSize();
+         } else {
+             return -1l;
+         }
+     }
      public static class ThumbnailGenerationTask extends AsyncTask<Object, Void, Bitmap> {
          private final WeakReference<ImageView> mImageViewReference;
 +        private WeakReference<ProgressBar> mProgressWheelRef;
          private static Account mAccount;
          private Object mFile;
 +        private Boolean mIsThumbnail;
          private FileDataStorageManager mStorageManager;
  
 -
          public ThumbnailGenerationTask(ImageView imageView, FileDataStorageManager storageManager,
                                         Account account) {
              // Use a WeakReference to ensure the ImageView can be garbage collected