Skip to content

Commit

Permalink
bug fix:file size == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
TangXiaoLv committed Jan 4, 2017
1 parent 1426c55 commit 596b6c9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fast,efficiently,low memory selector of album,extract from [Telegram](https:
###Gradle
```
dependencies {
compile 'com.library.tangxiaolv:telegramgallery:1.0.2'
compile 'com.library.tangxiaolv:telegramgallery:1.0.3'
}
```

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
###Gradle
```
dependencies {
compile 'com.library.tangxiaolv:telegramgallery:1.0.2'
compile 'com.library.tangxiaolv:telegramgallery:1.0.3'
}
```

Expand Down
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ android {
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile project(':telegramgallery')
// compile 'com.library.tangxiaolv:telegramgallery:1.0.2'
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
// NOTE: Do not place your application dependencies here; they belong
Expand Down
8 changes: 4 additions & 4 deletions telegramgallery/build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
tasks.withType(Javadoc) {
enabled = false //禁用生成javadoc的任务
enabled = false //Disable the task of 'generating javadoc'
options.encoding = "UTF-8"
}
ext {
bintrayRepo = 'maven'
bintrayName = 'telegramgallery' //maven 仓库中的包名
bintrayName = 'telegramgallery' //maven package name

publishedGroupId = 'com.library.tangxiaolv'
libraryName = 'telegramgallery'
artifact = 'telegramgallery'//必须跟Model名一样
artifact = 'telegramgallery'//Must be the same as the Model name

libraryDescription = 'android Gallery from Telegram'

siteUrl = 'https://github.com/TangXiaoLv/TelegramGallery'
gitUrl = 'https://github.com/TangXiaoLv/TelegramGallery.git'

libraryVersion = '1.0.2'
libraryVersion = '1.0.3'

developerId = 'tangxiaolv'
developerName = 'Tang XiaoLv'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.os.Build;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.SparseArray;

import com.tangxiaolv.telegramgallery.Gallery;
import com.tangxiaolv.telegramgallery.R;
Expand All @@ -29,6 +30,8 @@
import java.util.ArrayList;
import java.util.HashMap;

import static android.R.attr.orientation;

public class MediaController implements NotificationCenter.NotificationCenterDelegate {
public static int[] readArgs = new int[3];
private boolean saveToGallery = true;
Expand Down Expand Up @@ -64,8 +67,9 @@ public AudioBuffer(int capacity) {
MediaStore.Images.Media.BUCKET_DISPLAY_NAME,
MediaStore.Images.Media.DATA,
MediaStore.Images.Media.DATE_TAKEN,
MediaStore.Images.Media.ORIENTATION
// MediaStore.Files.FileColumns.MIME_TYPE
MediaStore.Images.Media.ORIENTATION,
MediaStore.Images.Media.SIZE
// MediaStore.Images.Media.MIME_TYPE
};

private static final String[] projectionVideo = {
Expand Down Expand Up @@ -529,7 +533,7 @@ public static void loadGalleryPhotosAlbums(final int guid, final String[] filter
public void run() {
final ArrayList<AlbumEntry> albumsSorted = new ArrayList<>();
final ArrayList<AlbumEntry> videoAlbumsSorted = new ArrayList<>();
HashMap<Integer, AlbumEntry> albums = new HashMap<>();
SparseArray<AlbumEntry> albums = new SparseArray<>();
AlbumEntry allPhotosAlbum = null;
String cameraFolder = Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
Expand Down Expand Up @@ -572,6 +576,8 @@ public void run() {
.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN);
int orientationColumn = cursor
.getColumnIndex(MediaStore.Images.Media.ORIENTATION);
int imageSize = cursor
.getColumnIndex(MediaStore.Files.FileColumns.SIZE);
// int mimeTypeColumn =
// cursor.getColumnIndex(MediaStore.Files.FileColumns.MIME_TYPE);

Expand All @@ -582,9 +588,10 @@ public void run() {
String path = cursor.getString(dataColumn);
long dateTaken = cursor.getLong(dateColumn);
int orientation = cursor.getInt(orientationColumn);
int size = cursor.getInt(imageSize);
// String mimeType = cursor.getString(mimeTypeColumn);

if (path == null || path.length() == 0) {
if (path == null || path.length() == 0 || size == 0) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion telegramgallery/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<string name="SearchImagesInfo">WEB SEARCH</string>
<string name="MostSelect">You can select up to %d pictures</string>

<string name="Send">Accept</string>
<string name="Send">Done</string>
<string name="Cancel">Cancel</string>
<string name="Preview">Preview</string>
<string name="album_read_fail">Failed to read an album, please check permissions</string>
Expand Down

0 comments on commit 596b6c9

Please sign in to comment.