Android-RTEditor
Android-RTEditor copied to clipboard
Insert very large image
Hi!! I have a problem when I insert a image very large, (1800x1800 for example), because the image is very large then i cant to see good the image in the editor, the image output from the edges, how can resize this image when it is inserting in the editor?
I've only been able to can resize the image when i save it in a folder of my app using my custom RTMedia, but I would like to save the same height and width but when it is displayed in the editor has a size adapted to the screen.
Thanks for this library ^^
If you extended RTMedia then you can override the getWidth and getHeight methods to get the real width and height and divede them by 8 or something. Maybe it will do the job. But keep in mind that all images stored in this custom RTMedia will be display smaller.
I will try to do it, thanks for answer me fast :D
:D
I'm trying to do it but i dont know what class would extends of RTMedia =/
I have done this with my custom RTMediaFactory....
public class RTMediaCustom extends RTMediaFactoryImpl implements RTMedia{
....
@Override
public RTImage createImage(RTMediaSource mediaSource) {
..........
}
@Override
public int getWidth(){
WindowManager wm = (WindowManager) ApplicationContext.getAppContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return (int)(size.x*0.9);
}
@Override
public int getHeight() {
WindowManager wm = (WindowManager) ApplicationContext.getAppContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return (int)(size.y*0.9);
}
}
But when i debug my app and I go in the RTEditor, overwritten (getWidth() and getHeight()
) methods do not start =/
you need to extend RTMediaImpl
You need to extend RTMediaFactoryImpl and RTImageImpl, e.g: RTMediaCustom extends RTMediaFactoryImpl and RTImageCustom extends RTImageImpl.
Your custom RTMediaFactoryImpl overrides createImage to return your custom RTImageImpl. Don't try to do it in one class since there's no multiple inheritance in Java and it also doesn't make sense from a design perspective.
nice to see you again :D
I was trying this... but this doesn't work because methods getWith() and getHeigth() don't start at any moments. But methods are good because when im debuging if I try to use its, they return good dates.
Where are using this methods ? Are these methods used in some class?
did you tried the suggestion of @1gravity ? Did you implement both the classes?
Yes, I implemented both classes =7
You can look it
public class RTMediaFactoryCustom extends RTMediaFactoryImpl {
private File mStoragePath;
public RTMediaFactoryCustom(Context context) {
super(context);
}
public RTMediaFactoryCustom(Context context, boolean externalStorage) {
super(context,externalStorage);
mStoragePath = externalStorage ?
context.getExternalFilesDir(null) :
context.getFilesDir();
}
@Override
public RTImage createImage(RTMediaSource mediaSource) {
File targetFile = loadMedia(mediaSource);
if(targetFile==null){
return null;
}else{
RTImageCustom rtImageCustom= new RTImageCustom(targetFile.getAbsolutePath());
return rtImageCustom;
}
}
}
public class RTImageCustom extends RTMediaImpl implements RTImage {
public RTImageCustom(String filePath) {
super(filePath);
}
@Override
public int getWidth(){
WindowManager wm = (WindowManager) ApplicationContext.getAppContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
/*return (int)(size.x*0.9);*/
return 100;
}
@Override
public int getHeight() {
WindowManager wm = (WindowManager) ApplicationContext.getAppContext().getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return 100;
}
}
public class RTImageCustom extends RTImageImpl {
try this
and now you have to change this on ImageProcessor
do you have teamviewer?
I'm using the library in my app I can't overriding this class (ImageProcessor) =/ and I can't install TeamViewer in this PC sorry
I'm sorry too, is to long to explain. You need to figure it out by yourself unless @1gravity helps you. Have a good day.
Thanks ^^