Skip to content

Commit

Permalink
Merge branch 'develop2' into imageGrid2
Browse files Browse the repository at this point in the history
Conflicts:
	owncloud-android-library
	res/layout/list_fragment.xml
	res/values-fr/strings.xml
	src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
	src/com/owncloud/android/ui/adapter/FileListListAdapter.java
	src/com/owncloud/android/ui/adapter/LocalFileListAdapter.java
	src/com/owncloud/android/ui/fragment/ExtendedListFragment.java
	src/com/owncloud/android/ui/fragment/LocalFileListFragment.java
	src/com/owncloud/android/ui/fragment/OCFileListFragment.java
  • Loading branch information
tobiasKaminsky committed Jan 19, 2015
1 parent 6d5c6f8 commit d4e0f3b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Oct 15 10:45:44 CEST 2014
#Sun Jan 18 17:01:43 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
2 changes: 1 addition & 1 deletion owncloud-android-library
Submodule owncloud-android-library updated from 826186 to cbb1c5
1 change: 1 addition & 0 deletions res/values/dims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
-->
<resources>
<dimen name="file_icon_size">32dp</dimen>
<dimen name="file_icon_size_grid">128dp</dimen>
</resources>
23 changes: 2 additions & 21 deletions src/com/owncloud/android/datamodel/ThumbnailsCacheManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,7 @@ protected Bitmap doInBackground(Object... params) {
}

mFile = params[0];
final String imageKey = String.valueOf(mFile.getRemoteId());

// Check disk cache in background thread
thumbnail = getBitmapFromDiskCache(imageKey);

// Not found in disk cache
if (thumbnail == null || mFile.needsUpdateThumbnail()) {
// Use Width of imageView -> no blurry images on big screens
int px = mImageViewReference.get().getWidth();

if (mFile.isDown()){
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(
mFile.getStoragePath(), px, px);

if (bitmap != null) {
thumbnail = ThumbnailUtils.extractThumbnail(bitmap, px, px);

// Add thumbnail to cache
addBitmapToCache(imageKey, thumbnail);


if (mFile instanceof OCFile) {
thumbnail = doOCFileInBackground();
} else if (mFile instanceof File) {
Expand Down Expand Up @@ -262,7 +243,7 @@ private Bitmap addThumbnailToCache(String imageKey, Bitmap bitmap, String path,
private int getThumbnailDimension(){
// Converts dp to pixel
Resources r = MainApp.getAppContext().getResources();
return (int) Math.round(r.getDimension(R.dimen.file_icon_size));
return (int) Math.round(r.getDimension(R.dimen.file_icon_size_grid));
}

private Bitmap doOCFileInBackground() {
Expand Down
7 changes: 0 additions & 7 deletions src/com/owncloud/android/ui/adapter/FileListListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ public View getView(int position, View convertView, ViewGroup parent) {
if (thumbnail != null && !file.needsUpdateThumbnail()){
fileIcon.setImageBitmap(thumbnail);
} else {

// generate new Thumbnail
if (ThumbnailsCacheManager.cancelPotentialWork(file, fileIcon)) {
final ThumbnailsCacheManager.ThumbnailGenerationTask task =
Expand All @@ -320,15 +319,11 @@ public View getView(int position, View convertView, ViewGroup parent) {
);
fileIcon.setImageDrawable(asyncDrawable);
task.execute(file);

}
}
} else {
fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName()));
}
else {
fileIcon.setImageResource(DisplayUtils.getResourceId(file.getMimetype(), file.getFileName()));
}
} else {
// Folder
if (checkIfFileIsSharedWithMe(file)) {
Expand Down Expand Up @@ -568,8 +563,6 @@ public void setSortOrder(Integer order, boolean ascending) {
mFiles = FileStorageUtils.sortFolder(mFiles);
notifyDataSetChanged();

}
sortDirectory();
}

private CharSequence showRelativeTimestamp(OCFile file){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ public void setListAdapter(ListAdapter listAdapter) {
public GridView getGridView() {
return imageView;
}

public void setFooterView(View footer) {
mList.addFooterView(footer, null, false);
mList.invalidate();
// TODO find solution
// mList.addFooterView(footer, null, false);
// mList.invalidate();
}


Expand Down
2 changes: 1 addition & 1 deletion src/com/owncloud/android/utils/DisplayUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ private static String getExtension(String filename) {

/**
* Converts Unix time to human readable format
* @param miliseconds that have passed since 01/01/1970
* @param milliseconds that have passed since 01/01/1970
* @return The human readable time for the users locale
*/
public static String unixTimeToHumanReadable(long milliseconds) {
Expand Down

0 comments on commit d4e0f3b

Please sign in to comment.