new plotter

This commit is contained in:
Sergey Solovyev
2013-01-14 17:52:22 +04:00
parent 8fb1272bd2
commit f08e03761b
15 changed files with 187 additions and 54 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -298,6 +298,8 @@
<string name="cpp_dash_dotted_line_style">Dash dotted (-.-.-)</string>
<string name="cpp_plotter">Function plotter</string>
<string name="cpp_plot_screenshot">Capture screenshot</string>
<string name="cpp_plot_screenshot_saved">Screenshot successfully saved: %1$s!</string>
<string name="cpp_plot_unable_to_save_screenshot">Screenshot cannot be saved as sdcard is not mounted. Mount sdcard and try again!</string>
</resources>

View File

@@ -6,7 +6,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.os.Environment;
import android.util.Log;
import org.jetbrains.annotations.NotNull;
@@ -67,20 +66,16 @@ public final class AndroidUtils2 {
public static String saveBitmap(@NotNull Bitmap bitmap,
@NotNull String path,
@NotNull String fileName) {
final File sdcardPath = Environment.getExternalStorageDirectory();
final File filePath = new File(sdcardPath, path);
final File filePath = new File(path);
filePath.mkdirs();
final String fullFileName = fileName + "_" + System.currentTimeMillis() + ".png";
final File file = new File(path, fullFileName);
final File file = new File(path, fileName);
if (!file.exists()) {
final String name = file.getAbsolutePath();
FileOutputStream fos = null;
try {
fos = new FileOutputStream(name);
fos = new FileOutputStream(name);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
} catch (FileNotFoundException e) {