boolean loadSAMMFile(String strFileName) { if (mSCanvas.isAnimationMode()) { // It must be not animation mode. } else { // canvas option setting SOptionSCanvas canvasOption = mSCanvas.getOption(); if (canvasOption == null) return false; canvasOption.mSAMMOption.setConvertCanvasSizeOption( PreferencesOfSAMMOption.getPreferenceLoadCanvasSize(mContext)); canvasOption.mSAMMOption.setConvertCanvasHorizontalAlignOption( PreferencesOfSAMMOption.getPreferenceLoadCanvasHAlign(mContext)); canvasOption.mSAMMOption.setConvertCanvasVerticalAlignOption( PreferencesOfSAMMOption.getPreferenceLoadCanvasVAlign(mContext)); canvasOption.mSAMMOption.setDecodePriorityFGData( PreferencesOfSAMMOption.getPreferenceDecodePriorityFGData(mContext)); // option setting mSCanvas.setOption(canvasOption); // show progress for loading data if (mSCanvas.loadSAMMFile(strFileName, true, false, false)) { // Loading Result can be get by callback function } else { Toast.makeText(this, "Load AMS File(" + strFileName + ") Fail!", Toast.LENGTH_LONG).show(); return false; } } return true; }
private boolean saveSAMMFile() { String savePath = mFolder.getPath() + '/' + ExampleUtils.getUniqueFilename(mFolder, APPLICATION_ID_NAME, SAVED_FILE_EXTENSION); Log.d(TAG, "Save Path = " + savePath); // canvas option setting SOptionSCanvas canvasOption = mSCanvas.getOption(); if (canvasOption == null) return false; canvasOption.mSAMMOption.setSaveImageSize(SOptionSAMM.SAMM_SAVE_OPTION_ORIGINAL_SIZE); mSCanvas.setOption(canvasOption); if (mSCanvas.saveSAMMFile(savePath)) { Toast.makeText( mContext, APPLICATION_ID_NAME + " is saved as \"" + savePath + "\"", Toast.LENGTH_LONG) .show(); return true; } else { Toast.makeText(mContext, "Fail to save : \"" + savePath + "\"", Toast.LENGTH_LONG).show(); return false; } }