diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 19d00da..c80bb09 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1,47 +1,46 @@
+ android:label="@string/title_activity_about" >
\ No newline at end of file
diff --git a/README.md b/README.md
index c14b0d4..df07c51 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,36 @@
Acrylic Paint
=============
Acrylic Paint is a coloring app for Android which helps you to share your imagination.
Made some changes from FingerPaint project taken from API demos.
Credits
-------
* [Anupam Shrivastava](https://github.com/anupam1525) - Original author (disappeared)
* [Valerio Bozzolan](https://github.com/valerio-bozzolan) - Revival of the project
-* [Marco Gagino](https://github.com/marcogagino-22) - Icons, graphics and heavy support
+* [Marco Gagino](https://github.com/marcogagino-22) - Icons, graphics and massive support
And thanks to all the contributors!
Licenses
--------
* [Android™ API demos](http://developer.android.com/samples/index.html) - Originally released under the Apache 2.0 license
* [Acrylic Paint anupam1525](https://github.com/anupam1525/AcrylicPaint) - Originally released under the Apache 2.0 license
* [Acrylic Paint valerio-bozzolan](https://github.com/valerio-bozzolan/AcrylicPaint) - Upgraded to the GNU General Public License
-Every line of this app it's "upgraded" from the Apache 2.0 license to the **GPLv3+ license**! Read more about "license upgrading" [here](https://www.gnu.org/licenses/quick-guide-gplv3.html#new-compatible-licenses)". (If I have done some errors during the license upgrade process, please tell me about how to upgrade the license of this app in the bug report...)
+Every line of this app it's "upgraded" from the Apache 2.0 license to the **GPLv3+ license**! Read more about "license upgrading" [here](https://www.gnu.org/licenses/quick-guide-gplv3.html#new-compatible-licenses). (If I have done some errors during the license upgrade process, please tell me about how to upgrade the license of this app in the bug report...)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Disclaimer
----------
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
diff --git a/res/values-it/strings.xml b/res/values-it/strings.xml
index fcb3e72..853a183 100644
--- a/res/values-it/strings.xml
+++ b/res/values-it/strings.xml
@@ -1,54 +1,55 @@
+
Acrylic Paint è uno strumento che ti aiuta a colorare la tua immaginazione.\n\nScegli un colore e libera la tua fantasia.\n\nPremi il tasto menù per più opzioni!\n\nDivertiti :)\n\nQuest\'app è un software libero rilasciato sotto i termini della licenza GNU General Public License.\nUn ringraziamento all\'autore originale Anupam Shrivastava, a Valerio Bozzolan per la riesumazione del progetto e a Marco Gagino per il sostegno spaventoso. Grazie a tutti i contributori!
Qui c\'è la tua tela. Inizia a colorare!
Colore
Grassetto
Sfocato
Dimensione
Gomma
Pulisci tutto
Salva
Condividi
Info
Dimensione predefinita: %1$s
Dimensione scelta: %1$s
Scegli dimensione:
La tua creazione è stata salvata in %1$s
Seleziona
Continua
Scegli un Colore
Condividi
Guarda cosa ho dipinto con Acrylic Paint! --- Acrylic Paint (Simple finger painting) - https://f-droid.org/app/anupam.acrylic
Condividi come testo
Non ci sono app con cui condividere il tuo lavoro…
Matita
Informazioni
Acrylic Paint
-Grazie per aver scelto Acrylic Paint!
Un software libero che… libera la tua creatività!
+Grazie per aver scelto Acrylic Paint!
Un software libero che libera la tua creatività!
Crediti
Ringraziamenti speciali a:
Valerio Bozzolan per l'intensa revisione al codice sorgente. È l'attuale manutentore di questa versione.
Marco Gagino per il profondo restyling e grande spirito di collaborazione!
Licenze
Questa versione di Acrylic Paint e il relativo codice sorgente sono distribuiti da Valerio Bozzolan sotto i
termini della licenza GNU GPLv3+.
-Ciò è per permettere a chiunque di usare, studiare, migliorare e ricondividere quest\'app con qualunque mezzo e per qualsiasi scopo: A patto di mantenere sempre questi diritti.
-Quest\'applicazione è rilasciata nella speranza che sia utile a tutti ma senza alcuna garanzia (nè garanzie di commerciabilità).
+Ciò è per permettere a chiunque di usare, studiare, migliorare e ricondividere quest\'app con qualunque mezzo e per qualsiasi scopo a patto di mantenere sempre questi diritti.
+Quest\'applicazione è rilasciata nella speranza che sia utile a tutti, ma senza alcuna garanzia (nè garanzie di commerciabilità).
Note
Se ti accorgi di qualche difetto o se hai idee, usa il bug tracker.
Contribuisci al codice sorgente su valerio-bozzolan/AcrylicPaint @GitHub.
Leggi il file README per maggiori informazioni.
Divertiti!
]]>
\ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 557fed9..39057a3 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,37 +1,57 @@
Acrylic Paint
- Acrylic Paint is a coloring tool which helps you to make anything of your imagination.\nPick the color you want and start painting.\n\nPress menu for more options!\n\nHappy painting :)\n\nThis software is released under the terms of the GNU General Public License Version 3+.\nThanks to Anupam Shrivastava for the idea, to Valerio Bozzolan for reviving the project and the physicist Marco Gagino for the strong support. Thanks to all the contributors!
+ Acrylic Paint is a coloring tool which helps you to make anything of your imagination.\nPick the color you want and start painting.\n\nPress menu for more options!\n\nHappy painting :)\n\nThis software is released under the terms of the GNU General Public License Version 3+.\nThanks to Anupam Shrivastava for the idea, to Valerio Bozzolan for reviving the project and the physicist Marco Gagino for the terrific support. Thanks to all the contributors!
Here is your canvas. Start to paint!
Color
Bold
Blur
Brush size
Erase
Erase all
Save
Share
About
Default size: %1$s
Selected size: %1$s
Choose your size:
Saved your artwork to %1$s
Select
Continue
OK
Pick a Color
Share
Look at what I painted with Acrylic Paint! --- Acrylic Paint (Simple finger painting) - https://f-droid.org/app/anupam.acrylic
Share as text
Can\'t locate an app to share with…
Pencil
About
Acrylic Paint
-Thanks for using Acrylic Paint!
A Free and Open Source software… to free your creativity!
+Thanks for using Acrylic Paint!
A Free and Open Source software to free your creativity!
+
+Credits
+Special thanks to:
+Valerio Bozzolan for the great work done reviewing the source code and optimising it. He currently carries on the work for this version of AcrylicPaint.
+Marco Gagino for the thorough restyling and the great participation!
+
+
+Licenses
+This version of Acrylic Paint and its source code are released by Valerio Bozzolan under the
+terms of the GNU GPLv3+ license.
+This license gives everyone the ability to use, study, better and share this app with any means and for every purpose as long as you offer these same rights to the otehrs.
+This app is distributed in the hope that it will be useful to everyone, but without any warranty; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+Note
+If you notice any problem or if you have some ideas feel free to use the bug tracker.
+Contribute to the source code: valerio-bozzolan/AcrylicPaint @GitHub.
+Read the README file for further information.
+
+Have fun!
]]>
-
\ No newline at end of file
diff --git a/res/values/theme.xml b/res/values/theme.xml
index 6844063..d750dbd 100644
--- a/res/values/theme.xml
+++ b/res/values/theme.xml
@@ -1,13 +1,15 @@
\ No newline at end of file
diff --git a/src/anupam/acrylic/EasyPaint.java b/src/anupam/acrylic/EasyPaint.java
index dce17da..26c7241 100644
--- a/src/anupam/acrylic/EasyPaint.java
+++ b/src/anupam/acrylic/EasyPaint.java
@@ -1,529 +1,521 @@
/*
* Copyright (C) 2014 Valerio Bozzolan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package anupam.acrylic;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Calendar;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.EmbossMaskFilter;
import android.graphics.MaskFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
-import android.view.WindowManager;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
@SuppressLint("ClickableViewAccessibility")
public class EasyPaint extends GraphicsActivity implements
ColorPickerDialog.OnColorChangedListener {
public static int DEFAULT_BRUSH_SIZE = 10;
private static int MAX_POINTERS = 10;
private static final float TOUCH_TOLERANCE = 4;
private Paint mPaint;
private MaskFilter mEmboss;
private MaskFilter mBlur;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// it removes the title from the actionbar(more space for icons?)
// this.getActionBar().setDisplayShowTitleEnabled(false);
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
-
- // this.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
- // it removes the navigation bar, but you can't paint without it and
- // once it is shown again, it doesn't hide again
-
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(new MyView(this));
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setColor(Color.GREEN);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(DEFAULT_BRUSH_SIZE);
mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 }, 0.4f, 6, 3.5f);
mBlur = new BlurMaskFilter(5, BlurMaskFilter.Blur.NORMAL);
if (isFirstTime()) {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle(R.string.app_name);
alert.setMessage(R.string.app_description);
alert.setNegativeButton(R.string.continue_fuck,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
Toast.makeText(getApplicationContext(),
R.string.here_is_your_canvas,
Toast.LENGTH_SHORT).show();
}
});
alert.show();
} else {
Toast.makeText(getApplicationContext(),
R.string.here_is_your_canvas, Toast.LENGTH_SHORT).show();
}
}
public void colorChanged(int color) {
mPaint.setColor(color);
}
public class MyView extends View {
private Bitmap mBitmap;
private Canvas mCanvas;
private Paint mBitmapPaint;
private MultiLinePathManager multiLinePathManager;
private class LinePath extends Path {
private Integer idPointer;
private float lastX;
private float lastY;
LinePath() {
this.idPointer = null;
}
public float getLastX() {
return lastX;
}
public float getLastY() {
return lastY;
}
public void touchStart(float x, float y) {
this.reset();
this.moveTo(x, y);
this.lastX = x;
this.lastY = y;
}
public void touchMove(float x, float y) {
float dx = Math.abs(x - lastX);
float dy = Math.abs(y - lastY);
if (dx >= TOUCH_TOLERANCE || dy >= TOUCH_TOLERANCE) {
this.quadTo(lastX, lastY, (x + lastX) / 2, (y + lastY) / 2);
lastX = x;
lastY = y;
}
}
public boolean isDisassociatedFromPointer() {
return idPointer == null;
}
public boolean isAssociatedToPointer(int idPointer) {
return this.idPointer != null
&& (int) this.idPointer == idPointer;
}
public void disassociateFromPointer() {
idPointer = null;
}
public void associateToPointer(int idPointer) {
this.idPointer = idPointer;
}
}
private class MultiLinePathManager {
public LinePath[] superMultiPaths;
MultiLinePathManager(int maxPointers) {
superMultiPaths = new LinePath[maxPointers];
for (int i = 0; i < maxPointers; i++) {
superMultiPaths[i] = new LinePath();
}
}
public LinePath findLinePathFromPointer(int idPointer) {
for (int i = 0; i < superMultiPaths.length; i++) {
if (superMultiPaths[i].isAssociatedToPointer(idPointer)) {
return superMultiPaths[i];
}
}
return null;
}
public LinePath addLinePathWithPointer(int idPointer) {
for (int i = 0; i < superMultiPaths.length; i++) {
if (superMultiPaths[i].isDisassociatedFromPointer()) {
superMultiPaths[i].associateToPointer(idPointer);
return superMultiPaths[i];
}
}
return null;
}
}
public MyView(Context c) {
super(c);
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
mBitmap = Bitmap.createBitmap(size.x, size.y,
Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
mBitmapPaint = new Paint(Paint.DITHER_FLAG);
multiLinePathManager = new MultiLinePathManager(MAX_POINTERS);
}
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
}
@Override
protected void onDraw(Canvas canvas) {
canvas.drawColor(0xFFFFFFFF);
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
for (int i = 0; i < multiLinePathManager.superMultiPaths.length; i++) {
canvas.drawPath(multiLinePathManager.superMultiPaths[i], mPaint);
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
LinePath linePath;
int index;
int id;
int eventMasked = event.getActionMasked();
switch (eventMasked) {
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
index = event.getActionIndex();
id = event.getPointerId(index);
linePath = multiLinePathManager.addLinePathWithPointer(id);
if (linePath != null) {
linePath.touchStart(event.getX(index), event.getY(index));
} else {
Log.e("anupam", "Too many fingers!");
}
break;
case MotionEvent.ACTION_MOVE:
for (int i = 0; i < event.getPointerCount(); i++) {
id = event.getPointerId(i);
index = event.findPointerIndex(id);
linePath = multiLinePathManager.findLinePathFromPointer(id);
if (linePath != null) {
linePath.touchMove(event.getX(index), event.getY(index));
}
}
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_CANCEL:
index = event.getActionIndex();
id = event.getPointerId(index);
linePath = multiLinePathManager.findLinePathFromPointer(id);
if (linePath != null) {
linePath.lineTo(linePath.getLastX(), linePath.getLastY());
// Commit the path to our offscreen
mCanvas.drawPath(linePath, mPaint);
// Kill this so we don't double draw
linePath.reset();
// Allow this LinePath to be associated to another idPointer
linePath.disassociateFromPointer();
}
break;
}
invalidate();
return true;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
mPaint.setXfermode(null);
mPaint.setAlpha(0xFF);
switch (item.getItemId()) {
case R.id.normal_brush_menu:
mPaint.setMaskFilter(null);
return true;
case R.id.color_menu:
new ColorPickerDialog(this, this, mPaint.getColor()).show();
return true;
case R.id.emboss_menu:
mPaint.setMaskFilter(mEmboss);
return true;
case R.id.blur_menu:
mPaint.setMaskFilter(mBlur);
return true;
case R.id.size_menu:
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.brush,
(ViewGroup) findViewById(R.id.root));
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setView(layout);
final AlertDialog alertDialog = builder.create();
alertDialog.show();
SeekBar sb = (SeekBar) layout.findViewById(R.id.seekBar1);
sb.setProgress(getStrokeSize());
final Button done = (Button) layout.findViewById(R.id.select_size);
final TextView txt = (TextView) layout
.findViewById(R.id.size_value);
txt.setText(String.format(
getResources().getString(R.string.default_size_is),
getStrokeSize()));
sb.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar,
final int progress, boolean fromUser) {
// Do something here with new value
mPaint.setStrokeWidth(progress);
txt.setText(String.format(
getResources().getString(
R.string.your_selected_size_is), progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
});
done.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
alertDialog.dismiss();
}
});
return true;
case R.id.erase_menu:
LayoutInflater inflater_e = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout_e = inflater_e.inflate(R.layout.brush,
(ViewGroup) findViewById(R.id.root));
AlertDialog.Builder builder_e = new AlertDialog.Builder(this)
.setView(layout_e);
final AlertDialog alertDialog_e = builder_e.create();
alertDialog_e.show();
SeekBar sb_e = (SeekBar) layout_e.findViewById(R.id.seekBar1);
sb_e.setProgress(getStrokeSize());
final Button done_e = (Button) layout_e
.findViewById(R.id.select_size);
final TextView txt_e = (TextView) layout_e
.findViewById(R.id.size_value);
txt_e.setText(String.format(
getResources().getString(R.string.default_size_is),
getStrokeSize()));
sb_e.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar,
final int progress, boolean fromUser) {
// Do something here with new value
mPaint.setStrokeWidth(progress);
txt_e.setText(String.format(
getResources().getString(
R.string.your_selected_size_is), progress));
}
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
});
done_e.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
alertDialog_e.dismiss();
}
});
// mPaint.setColor(bgColor);
mPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
return true;
case R.id.clear_all_menu:
Intent intent = getIntent();
overridePendingTransition(0, 0);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
overridePendingTransition(0, 0);
startActivity(intent);
return true;
case R.id.save_menu:
takeScreenshot(true);
break;
case R.id.share_menu:
File screenshotPath = takeScreenshot(false);
Intent i = new Intent();
i.setAction(Intent.ACTION_SEND);
i.setType("image/png");
i.putExtra(Intent.EXTRA_SUBJECT,
getString(anupam.acrylic.R.string.share_title_template));
i.putExtra(Intent.EXTRA_TEXT,
getString(anupam.acrylic.R.string.share_text_template));
i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(screenshotPath));
try {
startActivity(Intent.createChooser(i,
getString(anupam.acrylic.R.string.toolbox_share_title)));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(this.getApplicationContext(),
anupam.acrylic.R.string.no_way_to_share,
Toast.LENGTH_LONG).show();
}
break;
case R.id.about_menu:
Intent intentAbout = new Intent(EasyPaint.this,
AboutActivity.class);
startActivity(intentAbout);
break;
}
return super.onOptionsItemSelected(item);
}
/**
* This takes the screenshot of the whole screen. Is this a good thing?
*/
private File takeScreenshot(boolean showToast) {
View v = getWindow().getDecorView();
v.setDrawingCacheEnabled(true);
Bitmap cachedBitmap = v.getDrawingCache();
Bitmap copyBitmap = cachedBitmap.copy(Bitmap.Config.RGB_565, true);
FileOutputStream output = null;
File file = null;
try {
File path = Places.getScreenshotFolder();
Calendar cal = Calendar.getInstance();
file = new File(path,
cal.get(Calendar.YEAR) + "_" + (1 + cal.get(Calendar.MONTH)) + "_"
+ cal.get(Calendar.DAY_OF_MONTH) + "_"
+ cal.get(Calendar.HOUR_OF_DAY) + "_"
+ cal.get(Calendar.MINUTE) + "_" + cal.get(Calendar.SECOND)
+ ".png");
output = new FileOutputStream(file);
copyBitmap.compress(CompressFormat.PNG, 100, output);
} catch (FileNotFoundException e) {
file = null;
e.printStackTrace();
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
if (file != null) {
if (showToast)
Toast.makeText(
getApplicationContext(),
String.format(
getResources().getString(
R.string.saved_your_location_to),
file.getAbsolutePath()), Toast.LENGTH_LONG)
.show();
// sending a broadcast to the media scanner so it will scan the new
// screenshot.
Intent requestScan = new Intent(
Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
requestScan.setData(Uri.fromFile(file));
sendBroadcast(requestScan);
return file;
} else {
return null;
}
}
private boolean isFirstTime() {
SharedPreferences preferences = getPreferences(MODE_PRIVATE);
boolean ranBefore = preferences.getBoolean("RanBefore", false);
if (!ranBefore) {
// first time
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("RanBefore", true);
editor.commit();
}
return !ranBefore;
}
private int getStrokeSize() {
return (int) mPaint.getStrokeWidth();
}
}
\ No newline at end of file