@Override public void run() { String largeFilePath = imgUri.getPath(); String largeFileName = FileUtils.getFileName(largeFilePath); String thumbFilePath; if (largeFileName.startsWith("thumb_") && new File(largeFilePath).exists()) { // direct save thumbnail thumbFilePath = largeFilePath; mThumbFile = new File(thumbFilePath); } else { // save thumbnail String thumbFileName = "thumb_" + largeFileName; thumbFilePath = ImageUtils.IMG_SAVEPATH + thumbFileName; if (new File(thumbFilePath).exists()) { // check if thumbnail exist mThumbFile = new File(thumbFilePath); } else { try { // create thumbnail // Bitmap b = ImageUtils.loadImgThumbnail(largeFilePath, 200, 200); ImageUtils.createImageThumbnail( AppContext.getInstance(), largeFilePath, thumbFilePath, 800, 80); mThumbFile = new File(thumbFilePath); if (!mThumbFile.exists()) { handler.sendEmptyMessage(HANDLER_GET_THUMB_FAILED); } } catch (IOException e) { e.printStackTrace(); handler.sendEmptyMessage(HANDLER_GET_THUMB_FAILED); } } } handler.sendEmptyMessage(HANDLER_GET_THUMB_SUCCESS); }
public static Intent newIntent() { Intent intent = new Intent(AppContext.getInstance(), PublishActivity.class); return intent; }