Improved image display and details section.

parent bc1c37f7
......@@ -27,6 +27,9 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Formatter;
import java.util.GregorianCalendar;
import java.util.Locale;
import static com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade;
......@@ -219,6 +222,10 @@ public class ImageActivity extends AppCompatActivity {
}else{
// Get subSampling view
SubsamplingScaleImageView imageView = layout.findViewById(R.id.inside_imageview_sub);
// Use EXIF rotation
imageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_USE_EXIF);
// Allow more zooming
imageView.setMinimumDpi(10);
// Set image
imageView.setImage(ImageSource.uri(image.getPath()));
overlay.setVisibility(View.INVISIBLE);
......@@ -320,12 +327,20 @@ public class ImageActivity extends AppCompatActivity {
String type = Utils.getMimeType(image.getPath());
typeT.setText(type);
// Modified
modifiedT.setText(Long.toString(image.lastModified()));
// Convert from ms to time
Calendar date = new GregorianCalendar();
date.setTimeInMillis(image.lastModified());
// Format time as e.g. "Fri Feb 17 07:45:42 PST 2017"
StringBuilder sbu = new StringBuilder();
Formatter fmt = new Formatter(sbu);
fmt.format("%tc", date.getTime());
modifiedT.setText(sbu);
// Create and show dialog
AlertDialog.Builder builder = new AlertDialog.Builder(ImageActivity.this);
builder.setView(layout)
.setTitle(R.string.details)
.setTitle(R.string.details_image)
.setIcon(R.drawable.ic_information_outline_black_48dp)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
......
......@@ -36,6 +36,9 @@ import com.google.android.exoplayer2.util.Util;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Formatter;
import java.util.GregorianCalendar;
import java.util.Locale;
public class VideoActivity extends AppCompatActivity {
......@@ -221,12 +224,20 @@ public class VideoActivity extends AppCompatActivity {
String type = Utils.getMimeType(image.getPath());
typeT.setText(type);
// Modified
modifiedT.setText(Long.toString(image.lastModified()));
// Convert from ms to time
Calendar date = new GregorianCalendar();
date.setTimeInMillis(image.lastModified());
// Format time as e.g. "Fri Feb 17 07:45:42 PST 2017"
StringBuilder sbu = new StringBuilder();
Formatter fmt = new Formatter(sbu);
fmt.format("%tc", date.getTime());
modifiedT.setText(sbu);
// Create and show dialog
AlertDialog.Builder builder = new AlertDialog.Builder(VideoActivity.this);
builder.setView(layout)
.setTitle(R.string.details)
.setTitle(R.string.details_video)
.setIcon(R.drawable.ic_information_outline_black_48dp)
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
......
......@@ -24,7 +24,8 @@
<string name="delete_message">This will delete the image forever, are you sure?</string>
<string name="ok">OK</string>
<string name="details">Image details</string>
<string name="details_image">Image details</string>
<string name="details_video">Video details</string>
<string name="details_name_title">Name</string>
<string name="details_path_title">Path</string>
<string name="details_size_title">Size</string>
......
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