Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7dbdb95d
authored
Mar 17, 2017
by
Germán Callejas Alcántara
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Vista para editar picto arreglada(Ya funciona bien para editar la imagen o subir una nueva)
parent
a3d95466
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
67 deletions
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictoMenu.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictoMenu.java
View file @
7dbdb95d
...
...
@@ -3,6 +3,7 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator;
import
android.content.Intent
;
import
android.graphics.Bitmap
;
import
android.graphics.Point
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
...
...
@@ -136,10 +137,15 @@ public class PictoMenu {
rescaled
.
compress
(
Bitmap
.
CompressFormat
.
PNG
,
100
,
stream
);
byte
[]
byteArray
=
stream
.
toByteArray
();
intent
.
putExtra
(
EditPictoActivity
.
IMAGE_PICTO
,
byteArray
);
}
intent
.
putExtra
(
"tipo"
,
true
);
activity
.
startActivity
(
intent
);
Log
.
i
(
"TAG_PRUEBAS"
,
"---setPicto---"
);
Log
.
i
(
"TAG_PRUEBAS"
,
"row: "
+
row
);
Log
.
i
(
"TAG_PRUEBAS"
,
"col: "
+
col
);
Log
.
i
(
"TAG_PRUEBAS"
,
"expression: "
+
expression
);
activity
.
startActivityForResult
(
intent
,
EditPictoActivity
.
EDIT_PICTO_REQUEST
);
}
/**Function for build a radial menu
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/PictogramActivity.java
View file @
7dbdb95d
...
...
@@ -1151,28 +1151,19 @@ protected void showOnlyTape(boolean onlyTape) {
break
;
case
EditPictoActivity
.
EDIT_PICTO_REQUEST
:
if
(
resultCode
==
RESULT_OK
)
{
Log
.
i
(
"TAG_PRUEBAS"
,
"
Llega a fin de nuevo
"
);
int
row
=
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
ROW
,
-
1
);
int
col
=
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
COLUMN
,
-
1
);
int
freeRow
=
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeColumn
=
getIntent
().
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
Log
.
i
(
"TAG_PRUEBAS"
,
"
---REQUEST_OK_EDIT----
"
);
int
row
=
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
ROW
,
-
1
);
int
col
=
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
COLUMN
);
int
freeRow
=
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeColumn
=
data
.
getExtras
().
getInt
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
String
path
=
data
.
getExtras
().
getString
(
EditPictoActivity
.
PATH
);
String
legend
=
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
);
chooseTextAndSavePicto
(
path
,
row
,
col
,
freeRow
,
freeColumn
,
cat
,
legend
);
refresh
();
}
break
;
case
EditPictoActivity
.
FINISH_EDIT
:
Log
.
i
(
"TAG_PRUEBAS"
,
"Llega a fin de editar"
);
int
row
=
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
ROW
,
-
1
);
int
col
=
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
COLUMN
,
-
1
);
int
freeRow
=
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_ROW
,
-
1
);
int
freeColumn
=
data
.
getIntExtra
(
Picto
.
JSON_ATTTRS
.
FREE_COLUMN
,
-
1
);
String
path
=
data
.
getExtras
().
getString
(
EditPictoActivity
.
PATH
);
String
legend
=
data
.
getExtras
().
getString
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
);
chooseTextAndSavePicto
(
path
,
row
,
col
,
freeRow
,
freeColumn
,
cat
,
legend
);
break
;
}
}
...
...
android/Pictogram/tabletlibrary/src/main/java/com/yottacode/pictogram/tabletlibrary/gui/communicator/cropper/EditPictoActivity.java
View file @
7dbdb95d
...
...
@@ -239,42 +239,30 @@ public class EditPictoActivity extends Activity {
@Override
public
void
onClick
(
View
v
)
{
if
(
legend
.
getText
().
toString
().
trim
().
length
()
>
0
)
{
final
Bitmap
croppedImage
=
cropImageView
.
getCroppedImage
();
//Escalar imagen
Bitmap
finalImage
=
croppedImage
.
createScaledBitmap
(
croppedImage
,
100
,
100
,
true
);
//Guardar imagen en galeria y obtener la ruta
ByteArrayOutputStream
bytes
=
new
ByteArrayOutputStream
();
finalImage
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
bytes
);
String
title
=
getResources
().
getString
(
R
.
string
.
app_name
)
+
' '
+
legend
.
getText
().
toString
();
String
path
=
MediaStore
.
Images
.
Media
.
insertImage
(
PCBcontext
.
getContext
().
getContentResolver
(),
finalImage
,
title
,
null
);
path
=
getRealPathFromURI
(
Uri
.
parse
(
path
));
Log
.
i
(
LOG_PATH
,
" New image "
+
title
+
" saved at "
+
path
);
//Intent intent = new Intent(EditPictoActivity.this,PictogramActivity.class);//getIntent(); //Mandar a pictogram activity el path y el texto de la imagen
//intent.putExtra(PATH, path);
//intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, legend.getText().toString());
cropImageView
.
setImageBitmap
(
finalImage
);
if
(
editar
){
Log
.
i
(
"TAG_PRUEBAS"
,
"Lanza ok de editar"
);
//Intent intent = new Intent(EditPictoActivity.this,PictogramActivity.class);//Mandar a pictogram activity el path y el texto de la imagen
Intent
intent
=
getIntent
();
intent
.
putExtra
(
PATH
,
path
);
intent
.
putExtra
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
,
legend
.
getText
().
toString
());
intent
.
setAction
(
String
.
valueOf
(
FINISH_EDIT
));
//startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
}
else
{
Log
.
i
(
"TAG_PRUEBAS"
,
"Lanza ok de nuevo"
);
Intent
intent
=
getIntent
();
//Mandar a pictogram activity el path y el texto de la imagen
intent
.
putExtra
(
PATH
,
path
);
intent
.
putExtra
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
,
legend
.
getText
().
toString
());
setResult
(
RESULT_OK
,
intent
);
}
finish
();
//Termina la actividad de editar
}
else
Toast
.
makeText
(
getBaseContext
(),
R
.
string
.
crop_TextRequired
,
Toast
.
LENGTH_LONG
).
show
();
if
(
legend
.
getText
().
toString
().
trim
().
length
()
>
0
)
{
final
Bitmap
croppedImage
=
cropImageView
.
getCroppedImage
();
//Escalar imagen
Bitmap
finalImage
=
croppedImage
.
createScaledBitmap
(
croppedImage
,
100
,
100
,
true
);
//Guardar imagen en galeria y obtener la ruta
ByteArrayOutputStream
bytes
=
new
ByteArrayOutputStream
();
finalImage
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
bytes
);
String
title
=
getResources
().
getString
(
R
.
string
.
app_name
)
+
' '
+
legend
.
getText
().
toString
();
String
path
=
MediaStore
.
Images
.
Media
.
insertImage
(
PCBcontext
.
getContext
().
getContentResolver
(),
finalImage
,
title
,
null
);
path
=
getRealPathFromURI
(
Uri
.
parse
(
path
));
Log
.
i
(
LOG_PATH
,
" New image "
+
title
+
" saved at "
+
path
);
Intent
intent
=
getIntent
();
//Mandar a pictogram activity el path y el texto de la imagen
intent
.
putExtra
(
PATH
,
path
);
intent
.
putExtra
(
Picto
.
JSON_ATTTRS
.
EXPRESSION
,
legend
.
getText
().
toString
());
setResult
(
RESULT_OK
,
intent
);
cropImageView
.
setImageBitmap
(
finalImage
);
Log
.
i
(
"TAG_PRUEBAS"
,
"Lanza ok de editar"
);
finish
();
//Termina la actividad de editar
}
else
Toast
.
makeText
(
getBaseContext
(),
R
.
string
.
crop_TextRequired
,
Toast
.
LENGTH_LONG
).
show
();
}
});
...
...
@@ -553,18 +541,6 @@ public class EditPictoActivity extends Activity {
cropImageView
.
setImageBitmap
(
rescaled
);
}
break
;
/*case EditPictoActivity.EDIT_PICTO_REQUEST:
if (resultCode == RESULT_OK) {
int row = getIntent().getIntExtra(Picto.JSON_ATTTRS.ROW, -1);
int col = getIntent().getIntExtra(Picto.JSON_ATTTRS.COLUMN, -1);
int freeRow = getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_ROW, -1);
int freeColumn = getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1);
String path = data.getExtras().getString(EditPictoActivity.PATH);
String legend = data.getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend);
}
break;*/
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment