String getCardId();
String getContentPath();
String getContentName();
+ String getOriginalName();
+ boolean isRaw();
+ boolean isMovie();
boolean isDateValid();
+ boolean isContentNameValid();
Date getCapturedDate();
void setCapturedDate(Date date);
}
}
@Override
+ public String getOriginalName()
+ {
+ return (contentName);
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ String target = contentName.toLowerCase();
+ return ((target.endsWith("orf")) || (target.endsWith("dng")) || (target.endsWith("pef")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ String target = contentName.toLowerCase();
+ return ((target.endsWith("mov")) || (target.endsWith("mp4")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid()
{
return (isDateValid);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (true);
+ }
+
+ @Override
public Date getCapturedDate()
{
return (capturedDate);
}
@Override
+ public String getOriginalName()
+ {
+ if (realFileName != null)
+ {
+ return (realFileName);
+ }
+ return (getContentName());
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ if ((realFileName != null)&&(realFileName.contains(".RAF")))
+ {
+ return (true);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ if ((realFileName != null)&&(realFileName.contains(".MOV")))
+ {
+ return (true);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid()
{
return (isDateValid);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (false);
+ }
+
+ @Override
public Date getCapturedDate()
{
return (date);
this.target_image_size = imageSize;
this.isReceiveMulti = true;
this.receivedFirstData = false;
-/*
- NikonImageContentInfo content = imageObjectReceiver.getImageContent(objectId);
- if (content != null)
- {
- imageSize = content.getOriginalSize();
- }
-*/
+
Log.v(TAG, " getPartialObject (id : " + objectId + ", size:" + imageSize + ")");
publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_PARTIAL_OBJECT, true, 0, 0x101b, 12, objectId, 0, imageSize)); // GetPartialObject (0x101b)
}
// 受信したデータから、通信のヘッダ部分を削除する
byte[] body = cutHeader(rx_body);
int length = (body == null) ? 0 : body.length;
- Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes + " (" + length + " bytes.)");
+ Log.v(TAG, " onReceiveProgress() " + currentBytes + "/" + totalBytes + " (" + length + " bytes.) ");
callback.onProgress(body, length, new IProgressEvent() {
@Override
public float getProgress() {
private final String TAG = toString();
private Date date;
private String contentName = "";
+ private String originalFileName = null;
private boolean isDateValid = false;
- private boolean isContentNameValid = false;
private int contentSize = 0;
@Override
public String getContentName()
{
- if (isContentNameValid)
+/*
+ try
{
- return (contentName);
+ if ((originalFileName != null)&&(originalFileName.contains(".MOV")))
+ {
+ return (String.format("0x%08x.MOV", objectId));
+ }
}
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+*/
return (String.format("0x%08x.JPG", objectId));
}
@Override
+ public String getOriginalName()
+ {
+ if (originalFileName != null)
+ {
+ return (originalFileName);
+ }
+ return (getContentName());
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ if ((originalFileName != null)&&(originalFileName.contains(".NEF")))
+ {
+ return (true);
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ if (originalFileName != null)
+ {
+ if ((originalFileName.contains(".MOV"))||(originalFileName.contains(".MP4")))
+ {
+ return (true);
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid()
{
return (isDateValid);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (false);
+ }
+
+ @Override
public Date getCapturedDate()
{
return (date);
isDateValid = true;
}
- public void setContentName(String contentName)
+ void setContentName(String contentName)
{
- Log.v(TAG, "setContentName() : " + contentName);
- this.contentName = contentName;
- isContentNameValid = true;
+ Log.v(TAG, " ----- setContentName() : " + contentName);
+ this.originalFileName = contentName;
}
- public void setOriginalSize(int size)
+ void setOriginalSize(int size)
{
this.contentSize = size;
}
}
/*
- private List<PtpIpImageContentInfo> parseContentSubdirectories(byte[] rx_body, int offset)
+ private List<CanonImageContentInfo> parseContentSubdirectories(byte[] rx_body, int offset)
{
- List<PtpIpImageContentInfo> result = new ArrayList<>();
+ List<CanonImageContentInfo> result = new ArrayList<>();
try
{
int nofObjects = (rx_body[offset] & 0xff);
id = id + ((rx_body[dataIndex + 2] & 0xff) << 16);
id = id + ((rx_body[dataIndex + 3] & 0xff) << 24);
- PtpIpImageContentInfo content = new PtpIpImageContentInfo(id, "", rx_body, dataIndex, objectSize);
+ CanonImageContentInfo content = new CanonImageContentInfo(id, "", rx_body, dataIndex, objectSize);
result.add(content);
dataIndex = dataIndex + objectSize;
if (result.size() >= nofObjects)
import android.graphics.Color;
import android.util.Log;
+import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import net.osdn.gokigen.pkremote.IInformationReceiver;
import net.osdn.gokigen.pkremote.R;
+import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContent;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraContentListCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.ICameraFileInfo;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IContentInfoCallback;
import net.osdn.gokigen.pkremote.camera.vendor.ptpip.wrapper.playback.PtpIpThumbnailImageReceiver;
import net.osdn.gokigen.pkremote.preference.IPreferencePropertyAccessor;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
/**
*
*
private final Activity activity;
private final NikonInterfaceProvider provider;
private final NikonFullImageReceiver fullImageReceiver;
- private final NikonSmallImageReceiver smallImageReciever;
- private String raw_suffix = "NEF";
+ //private final NikonSmallImageReceiver smallImageReciever;
+ // private String raw_suffix = "NEF";
private boolean use_screennail_image = false;
private NikonImageObjectReceiver nikonImageObjectReceiver;
this.provider = provider;
nikonImageObjectReceiver = new NikonImageObjectReceiver(provider);
this.fullImageReceiver = new NikonFullImageReceiver(activity, provider.getCommandPublisher());
- this.smallImageReciever = new NikonSmallImageReceiver(activity, provider.getCommandPublisher());
+ //this.smallImageReciever = new NikonSmallImageReceiver(activity, provider.getCommandPublisher());
try
{
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
- raw_suffix = preferences.getString(IPreferencePropertyAccessor.CANON_RAW_SUFFIX, IPreferencePropertyAccessor.CANON_RAW_SUFFIX_DEFAULT_VALUE);
+ //raw_suffix = preferences.getString(IPreferencePropertyAccessor.CANON_RAW_SUFFIX, IPreferencePropertyAccessor.CANON_RAW_SUFFIX_DEFAULT_VALUE);
use_screennail_image = preferences.getBoolean(IPreferencePropertyAccessor.NIKON_USE_SCREENNAIL_AS_SMALL, false);
}
catch (Exception e)
@Override
public String getRawFileSuffix()
{
- return (raw_suffix);
+ //return (raw_suffix);
+ return ("NEF");
}
@Override
(((int) rx_body[readPosition + 3] & 0x000000ff) << 24);
content.setOriginalSize(imageSize);
Log.v(TAG, " CONTENT SIZE : " + imageSize);
+
+ readPosition = 5 * 16 + 4;
+ int length = ((int) rx_body[readPosition] & 0x000000ff) -1;
+ byte[] fileNameArray = new byte[length];
+ for (int index = 0; index < length; index++)
+ {
+ readPosition++;
+ fileNameArray[index] = rx_body[readPosition];
+ readPosition++;
+ }
+ content.setContentName(new String(fileNameArray));
+
+ readPosition = 7 * 16 - 1;
+ int dateTimeLength = ((int) rx_body[readPosition] & 0x000000ff) -1;
+ byte[] dateTimeArray = new byte[dateTimeLength];
+ for (int index = 0; index < dateTimeLength; index++)
+ {
+ readPosition++;
+ dateTimeArray[index] = rx_body[readPosition];
+ readPosition++;
+ }
+ content.setCapturedDate(getCameraContentDate(new String(dateTimeArray)));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private Date getCameraContentDate(String dateTime)
+ {
+ try
+ {
+ SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss", Locale.US); // "yyyyMMdd'T'HHmmss"
+ dateFormatter.setCalendar(new GregorianCalendar());
+ return (dateFormatter.parse(dateTime));
}
catch (Exception e)
{
e.printStackTrace();
}
+ return (new Date());
}
if (isSmallSize)
{
// スモールサイズの画像取得コマンド(シーケンス)を発行する
- smallImageReciever.issueCommand(content.getObjectId(), callback);
+ //smallImageReciever.issueCommand(content.getObjectId(), callback);
+ fullImageReceiver.issueCommand(content.getObjectId(), content.getOriginalSize(), callback);
}
else
{
}
@Override
+ public String getOriginalName()
+ {
+ return (name);
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ String target = name.toLowerCase();
+ return ((target.endsWith("orf")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ String target = name.toLowerCase();
+ return ((target.endsWith("mov")) || (target.endsWith("mp4")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid()
{
return (true);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (true);
+ }
+
+ @Override
public Date getCapturedDate()
{
try
}
@Override
+ public String getOriginalName()
+ {
+ return (getContentName());
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("rw2")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("mov")) || (target.endsWith("mp4")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid() {
return (isDateValid);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (true);
+ }
+
+ @Override
public Date getCapturedDate()
{
return (date);
int GET_STORAGE_HANDLE1 = 110;
int GET_STORAGE_HANDLE2 = 111;
int GET_STORAGE_HANDLE3 = 112;
- int GET_PARTIAL_OBJECT = 113;
-
+ int GET_PARTIAL_OBJECT= 113;
/*
int SEQ_REGISTRATION = 1;
import java.util.Date;
import java.util.TimeZone;
-public class PtpIpImageContentInfo implements ICameraContent
+public class CanonImageContentInfo implements ICameraContent
{
private final String TAG = toString();
private final int indexNumber;
private Date date;
private final byte[] rx_body;
- public PtpIpImageContentInfo(int indexNumber, String contentPath, byte[] binaryData, int offset, int length)
+ public CanonImageContentInfo(int indexNumber, String contentPath, byte[] binaryData, int offset, int length)
{
this.indexNumber = indexNumber;
this.contentPath = contentPath;
}
@Override
+ public String getOriginalName()
+ {
+ return (getContentName());
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("crw")) || (target.endsWith("cr2")) || (target.endsWith("cr3")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("mov")) || (target.endsWith("mp4")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
public boolean isDateValid()
{
return (isDateValid);
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (true);
+ }
+
+ @Override
public Date getCapturedDate()
{
return (date);
private final PtpIpInterfaceProvider provider;
private boolean isDumpLog = false;
private List<ICameraContent> imageObjectList;
- private List<PtpIpImageContentInfo> ptpIpImageObjectList;
+ private List<CanonImageContentInfo> ptpIpImageObjectList;
private ICameraContentListCallback callback = null;
private int subDirectoriesCount = -1;
private int receivedSubDirectoriesCount = -1;
break;
case GET_OBJECT_INFO_EX:
- List<PtpIpImageContentInfo> directries = parseContentSubdirectories(rx_body, 32);
+ List<CanonImageContentInfo> directries = parseContentSubdirectories(rx_body, 32);
{
// サブディレクトリの情報を拾う
- for (PtpIpImageContentInfo contentInfo : directries)
+ for (CanonImageContentInfo contentInfo : directries)
{
publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_OBJECT_INFO_EX_2, isDumpLog, 0, 0x9109, 12, 0x00010001, contentInfo.getId(), 0x00200000));
}
break;
case GET_OBJECT_INFO_EX_2:
- List<PtpIpImageContentInfo> subDirectries = parseContentSubdirectories(rx_body, 32);
+ List<CanonImageContentInfo> subDirectries = parseContentSubdirectories(rx_body, 32);
{
// 画像の情報を拾う
- for (PtpIpImageContentInfo contentInfo : subDirectries)
+ for (CanonImageContentInfo contentInfo : subDirectries)
{
publisher.enqueueCommand(new PtpIpCommandGeneric(this, GET_OBJECT_INFO_EX_3, isDumpLog, 0, 0x9109, 12, 0x00010001, contentInfo.getId(), 0x00200000));
}
{
Log.v(TAG, " --- CONTENT ---");
}
- List<PtpIpImageContentInfo> objects = parseContentSubdirectories(rx_body, 32);
+ List<CanonImageContentInfo> objects = parseContentSubdirectories(rx_body, 32);
if (objects.size() > 0)
{
imageObjectList.addAll(objects);
}
}
- private List<PtpIpImageContentInfo> parseContentSubdirectories(byte[] rx_body, int offset)
+ private List<CanonImageContentInfo> parseContentSubdirectories(byte[] rx_body, int offset)
{
- List<PtpIpImageContentInfo> result = new ArrayList<>();
+ List<CanonImageContentInfo> result = new ArrayList<>();
try
{
int nofObjects = (rx_body[offset] & 0xff);
id = id + ((rx_body[dataIndex + 2] & 0xff) << 16);
id = id + ((rx_body[dataIndex + 3] & 0xff) << 24);
- PtpIpImageContentInfo content = new PtpIpImageContentInfo(id, "", rx_body, dataIndex, objectSize);
+ CanonImageContentInfo content = new CanonImageContentInfo(id, "", rx_body, dataIndex, objectSize);
result.add(content);
dataIndex = dataIndex + objectSize;
if (result.size() >= nofObjects)
return (false);
}
- PtpIpImageContentInfo getContentObject(String fileName)
+ CanonImageContentInfo getContentObject(String fileName)
{
- for (PtpIpImageContentInfo contentInfo : ptpIpImageObjectList)
+ for (CanonImageContentInfo contentInfo : ptpIpImageObjectList)
{
if (fileName.matches(contentInfo.getContentName()))
start = 1;
}
final String indexStr = path.substring(start);
- PtpIpImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
+ CanonImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
if (content != null)
{
IPtpIpCommandPublisher publisher = provider.getCommandPublisher();
final String indexStr = path.substring(start);
//Log.v(TAG, "downloadContentThumbnail() : [" + path + "] " + indexStr);
- PtpIpImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
+ CanonImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
if (content != null)
{
IPtpIpCommandPublisher publisher = provider.getCommandPublisher();
start = 1;
}
final String indexStr = path.substring(start);
- PtpIpImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
+ CanonImageContentInfo content = canonImageObjectReceiver.getContentObject(indexStr);
if (content != null)
{
if (isSmallSize)
return (getContentNameString());
}
+ @Override
+ public String getOriginalName()
+ {
+ return (getContentName());
+ }
+
+ @Override
+ public boolean isRaw()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("arw")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ @Override
+ public boolean isMovie()
+ {
+ try
+ {
+ String target = getContentName().toLowerCase();
+ return ((target.endsWith("mov")) || (target.endsWith("mp4")));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
private String getContentNameObject()
{
String fileName = "";
{
int startIndex = contentString.indexOf("<dc:title>");
int endIndex = contentString.indexOf("</dc:title>");
- Log.v(TAG, "getContentNameString : " + contentString.substring(startIndex + 10, endIndex));
+ //Log.v(TAG, " getContentNameString : " + contentString.substring(startIndex + 10, endIndex));
return (contentString.substring(startIndex + 10, endIndex));
}
catch (Exception e)
}
@Override
+ public boolean isContentNameValid()
+ {
+ return (true);
+ }
+
+ @Override
public Date getCapturedDate()
{
if (contentObject != null)
private static final String CANON_RAW_SUFFIX = ".crw";
private static final String CANON_RAW_SUFFIX2 = ".cr2";
private static final String CANON_RAW_SUFFIX3 = ".cr3";
+ private static final String FUJI_RAW_SUFFIX = ".raf";
+
private MyContentDownloader contentDownloader;
private GridView gridView;
private ICameraRunMode runMode;
private LruCache<String, Bitmap> imageCache;
+ //private List<ICameraContent> imageContentList;
private List<CameraContentEx> imageContentList;
private ExecutorService executor;
private ImageGridViewAdapter adapter = null;
List<CameraContentEx> contentItems = new ArrayList<>();
HashMap<String, CameraContentEx> rawItems = new HashMap<>();
+
for (ICameraContent item : contents)
{
//Log.v(TAG, "......contents : [" + item.getContentName() + "]");
{
contentItems.add(new CameraContentEx(item, true, NIKON_RAW_SUFFIX));
}
+ else if (path.endsWith(FUJI_RAW_SUFFIX))
+ {
+ contentItems.add(new CameraContentEx(item, true, FUJI_RAW_SUFFIX));
+ }
}
for (CameraContentEx item : contentItems)
private final Activity activity;
private final IPlaybackControl playbackControl;
private final IContentDownloadNotify receiver;
- private static final String RAW_SUFFIX_1 = ".DNG";
- private static final String RAW_SUFFIX_2 = ".ORF";
- private static final String RAW_SUFFIX_3 = ".PEF";
- private static final String RAW_SUFFIX_4 = ".RW2";
- private static final String RAW_SUFFIX_5 = ".ARW";
+ private static final String RAW_SUFFIX_1 = ".DNG"; // RAW: Ricoh / Pentax
+ private static final String RAW_SUFFIX_2 = ".ORF"; // RAW: Olympus
+ private static final String RAW_SUFFIX_3 = ".PEF"; // RAW: Pentax
+ private static final String RAW_SUFFIX_4 = ".RW2"; // RAW: Panasonic
+ private static final String RAW_SUFFIX_5 = ".ARW"; // RAW: Sony
+ private static final String RAW_SUFFIX_6 = ".CRW"; // RAW: Canon
+ private static final String RAW_SUFFIX_7 = ".CR2"; // RAW: Canon
+ private static final String RAW_SUFFIX_8 = ".CR3"; // RAW: Canon
+ private static final String RAW_SUFFIX_9 = ".NEF"; // RAW: Nikon
+ private static final String RAW_SUFFIX_0 = ".RAF"; // RAW: Fuji
private static final String MOVIE_SUFFIX = ".MOV";
private static final String MOVIE_SUFFIX_MP4 = ".MP4";
private static final String JPEG_SUFFIX = ".JPG";
Log.v(TAG, "startDownload() ICameraFileInfo is NULL...");
return;
}
- Log.v(TAG, "startDownload() " + fileInfo.getContentName());
+ Log.v(TAG, "startDownload() " + fileInfo.getOriginalName());
// Download the image.
try
{
isDownloading = true;
- Calendar calendar = Calendar.getInstance();
- String extendName = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.getDefault()).format(calendar.getTime());
- targetFileName = fileInfo.getContentName().toUpperCase();
+ String contentFileName = fileInfo.getContentName().toUpperCase();
if (replaceJpegSuffix != null)
{
- targetFileName = targetFileName.replace(JPEG_SUFFIX, replaceJpegSuffix);
+ contentFileName = contentFileName.replace(JPEG_SUFFIX, replaceJpegSuffix);
}
- if (targetFileName.toUpperCase().contains(RAW_SUFFIX_1))
+ if (contentFileName.toUpperCase().contains(RAW_SUFFIX_1))
{
mimeType = "image/x-adobe-dng";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(RAW_SUFFIX_2))
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_2))
{
mimeType = "image/x-olympus-orf";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(RAW_SUFFIX_3))
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_3))
{
mimeType = "image/x-pentax-pef";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(RAW_SUFFIX_4))
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_4))
{
- mimeType = "image/x-panasonic-raw2";
+ mimeType = "image/x-panasonic-rw2";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(RAW_SUFFIX_5))
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_5))
{
mimeType = "image/x-sony-arw";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(MOVIE_SUFFIX))
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_6))
+ {
+ mimeType = "image/x-canon-crw";
+ isSmallSize = false;
+ }
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_7))
+ {
+ mimeType = "image/x-canon-cr2";
+ isSmallSize = false;
+ }
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_8))
+ {
+ mimeType = "image/x-canon-cr3";
+ isSmallSize = false;
+ }
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_9))
+ {
+ mimeType = "image/x-nikon-nef";
+ isSmallSize = false;
+ }
+ else if (contentFileName.toUpperCase().contains(RAW_SUFFIX_0))
+ {
+ mimeType = "image/x-fuji-raf";
+ isSmallSize = false;
+ }
+ else if (contentFileName.toUpperCase().contains(MOVIE_SUFFIX))
{
mimeType = "video/mp4";
isSmallSize = false;
}
- else if (targetFileName.toUpperCase().contains(MOVIE_SUFFIX_MP4))
+ else if (contentFileName.toUpperCase().contains(MOVIE_SUFFIX_MP4))
{
mimeType = "video/mp4";
isSmallSize = false;
mimeType = "image/jpeg";
}
+ targetFileName = fileInfo.getOriginalName().toUpperCase();
+
////// ダイアログの表示
activity.runOnUiThread(new Runnable() {
@Override
downloadDialog.show();
}
});
- String path = fileInfo.getContentPath() + "/" + targetFileName;
final String directoryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getPath() + "/" + activity.getString(R.string.app_name2) + "/";
- String outputFileName = extendName + "_" + targetFileName;
+
+ Calendar calendar = Calendar.getInstance();
+ String extendName = new SimpleDateFormat("yyyyMMdd-HHmmss", Locale.getDefault()).format(calendar.getTime());
+ int periodPosition = targetFileName.indexOf(".");
+ String extension = targetFileName.substring(periodPosition);
+ String baseFileName = targetFileName.substring(0, periodPosition);
+ String outputFileName = baseFileName + "_" + extendName + extension;
filepath = new File(directoryPath.toLowerCase(), outputFileName.toLowerCase()).getPath();
try
{
}
outputStream = new FileOutputStream(filepath);
+ String path = fileInfo.getContentPath() + "/" + contentFileName;
Log.v(TAG, "downloadContent : " + path + " (small: " + isSmallSize + ")");
playbackControl.downloadContent(path, isSmallSize, this);
}
outputStream.close();
outputStream = null;
}
- if ((!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_1))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_2))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_3)))
+/*
+ // RAW ファイルを、ContentResolverに登録しない場合。。。
+ if ((!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_1))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_2))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_3))&&
+ (!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_4))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_5))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_6))&&
+ (!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_7))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_8))&&(!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_9))&&
+ (!targetFileName.toUpperCase().endsWith(RAW_SUFFIX_0)))
+*/
{
// ギャラリーに受信したファイルを登録する
long now = System.currentTimeMillis();
public boolean hasRaw()
{
+ if (!(fileInfo.isContentNameValid()))
+ {
+ //
+
+
+ }
return (hasRaw);
}
{
executor = Executors.newFixedThreadPool(1);
}
- executor.execute(new ImageThumbnailLoader(activity, playbackControl, imageCache, viewHolder, path, infoEx.hasRaw(), infoEx.isMovie()));
+ executor.execute(new ImageThumbnailLoader(activity, playbackControl, imageCache, viewHolder, path, infoEx));
}
}
else
{
viewHolder.getImageView().setImageBitmap(thumbnail);
- if (infoEx.isMovie())
+ if (infoEx.getFileInfo().isMovie())
{
viewHolder.getIconView().setImageResource(R.drawable.ic_videocam_grey_24dp);
}
- else if (infoEx.hasRaw())
+ else if (infoEx.getFileInfo().isRaw())
{
viewHolder.getIconView().setImageResource(R.drawable.ic_raw_black_1x);
}
import net.osdn.gokigen.pkremote.R;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IDownloadThumbnailImageCallback;
import net.osdn.gokigen.pkremote.camera.interfaces.playback.IPlaybackControl;
+import net.osdn.gokigen.pkremote.playback.detail.CameraContentEx;
import java.util.Map;
private final AppCompatActivity activity;
private LruCache<String, Bitmap> imageCache;
private String path;
- private final boolean hasRaw;
- private final boolean isMovie;
+ private final CameraContentEx infoEx;
- ImageThumbnailLoader(@NonNull AppCompatActivity activity, @NonNull IPlaybackControl playbackControl, LruCache<String, Bitmap> imageCache, ImageGridCellViewHolder viewHolder, String path, boolean hasRaw, boolean isMovie)
+ ImageThumbnailLoader(@NonNull AppCompatActivity activity, @NonNull IPlaybackControl playbackControl, LruCache<String, Bitmap> imageCache, ImageGridCellViewHolder viewHolder, String path, CameraContentEx infoEx)
{
this.activity = activity;
this.playbackControl = playbackControl;
this.imageCache = imageCache;
this.viewHolder = viewHolder;
this.path = path;
- this.hasRaw = hasRaw;
- this.isMovie = isMovie;
+ this.infoEx = infoEx;
}
@Override
@Override
public void run() {
viewHolder.getImageView().setImageBitmap(thumbnail);
- if (isMovie) {
+ if (infoEx.getFileInfo().isMovie()) {
viewHolder.getIconView().setImageResource(R.drawable.ic_videocam_grey_24dp);
- } else if (hasRaw) {
+ } else if (infoEx.getFileInfo().isRaw()) {
viewHolder.getIconView().setImageResource(R.drawable.ic_raw_black_1x);
} else {
viewHolder.getIconView().setImageDrawable(null);