Showing Preview of Multimedia

This commit is contained in:
Ali Shariat 2015-09-29 12:25:02 +03:30
parent 7926060945
commit bf35ea60fe
3 changed files with 8 additions and 7 deletions

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

View File

@ -40,7 +40,7 @@ import java.io.File;
* To load the image I am using the super great Glide library
* which only requires a single line of code in this file.
*/
public class ImagePickerFragment extends FilePickerFragment {
public class MultimediaPickerFragment extends FilePickerFragment {
// Make sure these do not collide with LogicHandler.VIEWTYPE codes.
// They are 1-2, so 11 leaves a lot of free space in between.
@ -48,13 +48,13 @@ public class ImagePickerFragment extends FilePickerFragment {
private static final int VIEWTYPE_IMAGE = 12;
/**
* An extremely simple method for identifying images. This
* An extremely simple method for identifying multimedia. This
* could be improved, but it's good enough for this example.
*
* @param file which could be an image
* @return true if the file can be previewed, false otherwise
*/
protected boolean isImage(File file) {
protected boolean isMultimedia(File file) {
//noinspection SimplifiableIfStatement
if (isDir(file)) {
return false;
@ -78,7 +78,7 @@ public class ImagePickerFragment extends FilePickerFragment {
*/
@Override
public int getItemViewType(int position, File file) {
if (isImage(file)) {
if (isMultimedia(file)) {
if (isCheckable(file)) {
return VIEWTYPE_IMAGE_CHECKABLE;
} else {

View File

@ -107,7 +107,8 @@
android:layout_gravity="left"
android:fontFamily="light"
android:gravity="center_vertical"
android:text="Use light theme" />
android:text="Use light theme"
android:checked="true"/>
</LinearLayout>
@ -131,7 +132,7 @@
android:layout_marginTop="16dp"
android:fontFamily="light"
android:gravity="center"
android:text="Pick SD-card with image preview" />
android:text="Pick SD-card with multimedia preview" />
<Button
android:id="@+id/button_ftp"