Commit 30ad4caa authored by Donald's avatar Donald

fixed #171

 now is possible to change the column count of media programmaticaly with the volume keys and with the ScaleGesture pinch in/pinch out
 fixed a backup issue with content from mediastore
 commented draggable scroolbar
parent ed0df607
......@@ -11,7 +11,6 @@ import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.util.Log;
import android.webkit.MimeTypeMap;
import com.drew.imaging.ImageMetadataReader;
......@@ -34,7 +33,6 @@ import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
......@@ -143,7 +141,7 @@ public class Media implements Parcelable, Serializable {
public boolean isVideo() { return getMIME().startsWith("video"); }
public Uri getUri() {
return isFromContentProvider() ? Uri.parse(uri) : Uri.fromFile(new File(path));
return hasUri() ? Uri.parse(uri) : Uri.fromFile(new File(path));
}
@TestOnly
......@@ -193,7 +191,7 @@ public class Media implements Parcelable, Serializable {
}
private void loadMetadata() {
if (isFromContentProvider() && metadataMap.isEmpty()) {
if (hasPath() && metadataMap.isEmpty()) {
try {
Metadata metadata = ImageMetadataReader.readMetadata(new File(getPath()));
for (Directory directory : metadata.getDirectories())
......@@ -242,10 +240,14 @@ public class Media implements Parcelable, Serializable {
return false;
}
private boolean isFromContentProvider() {
private boolean hasPath() {
return path != null;
}
private boolean hasUri() {
return uri != null;
}
@Nullable public String getExifInfo() {
StringBuilder result = new StringBuilder();
String asd;
......@@ -374,7 +376,7 @@ public class Media implements Parcelable, Serializable {
}
public String getDisplayName() {
return isFromContentProvider() ? getPath() : getUri().getEncodedPath();
return hasPath() ? getPath() : getUri().getEncodedPath();
}
public long getDateModified() {
......
......@@ -380,8 +380,6 @@ public class MainActivity extends SharedMediaActivity {
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
swipeRefreshLayout.setEnabled(false);
mediaAdapter.setOnClickListener(null);
mediaAdapter.setOnLongClickListener(null);
return super.onScaleBegin(detector);
}
......@@ -404,8 +402,6 @@ public class MainActivity extends SharedMediaActivity {
@Override
public void onScaleEnd(ScaleGestureDetector detector) {
super.onScaleEnd(detector);
mediaAdapter.setOnClickListener(photosOnClickListener);
mediaAdapter.setOnLongClickListener(photosOnLongClickListener);
swipeRefreshLayout.setEnabled(true);
}
});
......@@ -524,15 +520,16 @@ public class MainActivity extends SharedMediaActivity {
}
}
@Override public boolean onKeyDown(int keyCode, KeyEvent event)
{
int spanCount = ((GridLayoutManager) rvMedia.getLayoutManager()).getSpanCount();
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
changeSpanCountRvMedia(spanCount - 1);
return true;
} else if(keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
changeSpanCountRvMedia(spanCount + 1);
return true;
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
if (!albumsMode) {
int spanCount = ((GridLayoutManager) rvMedia.getLayoutManager()).getSpanCount();
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
changeSpanCountRvMedia(spanCount - 1);
return true;
} else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
changeSpanCountRvMedia(spanCount + 1);
return true;
}
}
return super.onKeyDown(keyCode, event); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment