Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #53 from alishari/master
Browse files Browse the repository at this point in the history
Add Video Thumbnail preview and set default theme to light
  • Loading branch information
spacecowboy committed Sep 29, 2015
2 parents d5a4122 + bf35ea6 commit bcf59d4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</activity>

<activity
android:name="com.nononsenseapps.filepicker.sample.ImagePickerActivity"
android:name=".MultimediaPickerActivity"
android:label="@string/title_activity_no_nonsense_file_picker"
android:theme="@style/SampleTheme">
<intent-filter>
Expand All @@ -74,7 +74,7 @@
</activity>

<activity
android:name="com.nononsenseapps.filepicker.sample.ImagePickerActivity2"
android:name=".MultimediaPickerActivity2"
android:label="@string/title_activity_no_nonsense_file_picker"
android:theme="@style/SampleThemeLight">
<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
/**
* All this class does is return a suitable fragment.
*/
public class ImagePickerActivity extends AbstractFilePickerActivity {
public class MultimediaPickerActivity extends AbstractFilePickerActivity {

public ImagePickerActivity() {
public MultimediaPickerActivity() {
super();
}

@Override
protected AbstractFilePickerFragment<File> getFragment(
final String startPath, final int mode, final boolean allowMultiple,
final boolean allowCreateDir) {
AbstractFilePickerFragment<File> fragment = new ImagePickerFragment();
AbstractFilePickerFragment<File> fragment = new MultimediaPickerFragment();
// startPath is allowed to be null. In that case, default folder should be SD-card and not "/"
fragment.setArgs(startPath != null ? startPath : Environment.getExternalStorageDirectory().getPath(),
mode, allowMultiple, allowCreateDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
/**
* Duplicate to allow second theme to be used.
*/
public class ImagePickerActivity2 extends ImagePickerActivity {
public class MultimediaPickerActivity2 extends MultimediaPickerActivity {
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@
* 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.
private static final int VIEWTYPE_IMAGE_CHECKABLE = 11;
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;
Expand All @@ -78,7 +78,7 @@ protected boolean isImage(File file) {
*/
@Override
public int getItemViewType(int position, File file) {
if (isImage(file)) {
if (isMultimedia(file)) {
if (isCheckable(file)) {
return VIEWTYPE_IMAGE_CHECKABLE;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ public void onClick(final View v) {

if (checkLightTheme.isChecked()) {
i = new Intent(NoNonsenseFilePicker.this,
ImagePickerActivity2.class);
MultimediaPickerActivity2.class);
} else {
i = new Intent(NoNonsenseFilePicker.this,
ImagePickerActivity.class);
MultimediaPickerActivity.class);
}
i.setAction(Intent.ACTION_GET_CONTENT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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"
Expand Down

0 comments on commit bcf59d4

Please sign in to comment.