iamutkarshtiwari / ananas Goto Github PK
View Code? Open in Web Editor NEWAn easy image editor integration for your Android apps.
License: MIT License
An easy image editor integration for your Android apps.
License: MIT License
which activity is used as a launcher activity?
@iamutkarshtiwari
In my application the default theme has the default ActionBar of the android application that the Android studio provides.
So when i open the EditImageActivity its like i see two action bars. I want to keep your actionBar and hide mine. How can i do that?
I plan to upgrade from SimpleCropView
library to Cropper
for lower apk size and cleaner interface.
Hi! First of all, thank you for this very handy tool!
I just want to report that I get the above mentioned exception when using more than one of the editing tools. I will also look into it on my side and report back, but wanted you to know.
The crash log is as follows:
android.view.WindowLeaked: Activity iamutkarshtiwari.github.io.ananas.editimage.EditImageActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{12dc24ab V.E..... R......D 0,0-480,174} that was originally added here at android.view.ViewRootImpl.<init>(ViewRootImpl.java:530) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:287) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91) at android.app.Dialog.show(Dialog.java:325) at iamutkarshtiwari.github.io.ananas.editimage.fragment.FilterListFragment$ProcessingImage.onPreExecute(FilterListFragment.java:172) at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:591) at android.os.AsyncTask.execute(AsyncTask.java:539) at iamutkarshtiwari.github.io.ananas.editimage.fragment.FilterListFragment.enableFilter(FilterListFragment.java:121) at iamutkarshtiwari.github.io.ananas.editimage.adapter.FilterAdapter$1.onClick(FilterAdapter.java:78) at android.view.View.performClick(View.java:5246) at android.view.View$PerformClick.run(View.java:21256) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6934) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
This happened when I tried to apply a filter. When tapping on the appropriate filter, the app crashes with this message. This also seems to happen when going to the "Beauty" tool and trying to apply anything in there.
Thank you.
Regards,
Hermann
In my app, I select an image to edit. Editor opens... Then I changed my mind, do not anything and go back with "<" button.
It returned onActivityResult() with RESULT_OK code. If I edit or not, it returns with same RESULT_OK code.
Hi! First of all, thank you for this very handy tool!
If you can edit multiple photos one after the other, please apply if there is a way.
sticker not scaling
Improve seek bars in Rotate, Brightness, Saturation and Beautify fragments.
Every time I selects image, I get failed to load the image!
I've tried many different ways but I didn't get what's the problem. I shared my code please check and let me know if there is any problem in implementation.
try {
Intent intent = new ImageEditorIntentBuilder(this, data.getData(), Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.png")
.withAddText() // Add the features you need
.withFilterFeature()
.withRotateFeature()
.withCropFeature()
.withStickerFeature()
.forcePortrait(true)
.build();
EditImageActivity.start((MainActivity) mContext, intent, PHOTO_EDITOR_REQUEST_CODE);
} catch (Exception e) {
Log.e(TAG, "onActivityResult: "+e.getMessage() );
}
Hello, Pinch to zoom feature not working for me while editing the image. Is there something I need to do to enable it? Or it should work by default. Or this feature is not present currently in the api. Please let me know regarding this. That'll be a big help. Thank you.
First of all, thanks for this beautiful library.
I was having Manifest merge issue while adding this library with my application. Later I resolved that issue by updating the manifest file with two attributes:
tools:node="merge"
tools:replace="android:label,android:allowBackup,android:supportsRtl"
After I am having one issue when starting the SelectPictureActivity from my application. It shows empty black grids with gallery names but no images. While clicking the empty grids it returns null.
Here is my application gradle and other info:
Kotlin version: 1.3.50
Ananas Library version: 1.2.3
Included the JavaVersion.VERSION_1_8 in compilerOptions.
Not using RxJava.
minSdkVersion: 21
Thanks in advance.
It seems that the there is no variable defined to get the new image output file path.
String newFilePath = data.getStringExtra(EditImageActivity.OUTPUT_PATH);
OUTPUT_PATH :- not defined
Please assist.
java.lang.NullPointerException: Attempt to write to field 'int iamutkarshtiwari.github.io.ananas.editimage.EditImageActivity.mode' on a null object reference
at iamutkarshtiwari.github.io.ananas.editimage.fragment.StickerFragment.onShow(StickerFragment.java:104)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.MainMenuFragment.onStickClick(MainMenuFragment.java:145)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.MainMenuFragment.onClick(MainMenuFragment.java:123)
at android.view.View.performClick(View.java:6597)
at android.view.View.performClickInternal(View.java:6574)
at android.view.View.access$3100(View.java:778)
at android.view.View$PerformClick.run(View.java:25885)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at androidx.test.espresso.base.Interrogator.a(Interrogator.java:31)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:132)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:126)
at androidx.test.espresso.base.UiControllerImpl.a(UiControllerImpl.java:42)
at androidx.test.espresso.action.MotionEvents.a(MotionEvents.java:75)
at androidx.test.espresso.action.Tap.b(Tap.java:16)
at androidx.test.espresso.action.Tap$1.a(Tap.java:2)
at androidx.test.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:11)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform(ViewInteraction.java:8)
at androidx.test.espresso.ViewInteraction.a(ViewInteraction.java:33)
at androidx.test.espresso.ViewInteraction$1.call(ViewInteraction.java:2)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
When I was testing it on Pixel 2, API level 28.
Unable to start activity ComponentInfo{com.test.app/iamutkarshtiwari.github.io.ananas.editimage.EditImageActivity}: android.view.InflateException: Binary XML file line #94: Binary XML file line #94: Error inflating class iamutkarshtiwari.github.io.ananas.editimage.layout.ZoomLayout
if it is not enabled
JavaVersion.VERSION_1_8
the following error occurs
the following options must be enabled in the build.grandle (Module App) by entering the following code
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
I also remember to add in the Manifest
<activity
android: name = "iamutkarshtiwari.github.io.ananas.picchooser.SelectPictureActivity">
</ Activity>
<activity
android: name = "iamutkarshtiwari.github.io.ananas.editimage.EditImageActivity"
Android: windowSoftInputMode = "adjustPan">
</ Activity>
to avoid exceptions during the execution phase.
After applying crop, toast "Error while saving image" is displayed.
Problem is probably in CropFragment , line 201: Single.fromCallable(() -> cropPanel.getCroppedImage());
method getCroppedImage is called from background thread, but it should not, because it works with view (mImageView.clearAnimation())
This problem does not happens on all devices, reproduced on Galaxy Tab S2 , Android 7
Stacktrace:
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7831)
at android.view.ViewRootImpl.invalidateChildInParent(ViewRootImpl.java:1342)
at android.view.ViewGroup.invalidateChild(ViewGroup.java:5449)
at android.view.View.invalidateInternal(View.java:14807)
at android.view.View.invalidate(View.java:14771)
at android.view.View.invalidateParentIfNeeded(View.java:14960)
at android.view.View.clearAnimation(View.java:21431)
at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:763)
at com.theartofdev.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:737)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.crop.CropFragment.lambda$getCroppedBitmap$4$CropFragment(CropFragment.java:201)
at iamutkarshtiwari.github.io.ananas.editimage.fragment.crop.-$$Lambda$CropFragment$Y_hl9FvcrZ26G-Bb-gpLHqbxGQw.call(lambda)
at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(SingleFromCallable.java:44)
at io.reactivex.Single.subscribe(Single.java:3575)
at io.reactivex.internal.operators.single.SingleSubscribeOn$SubscribeOnObserver.run(SingleSubscribeOn.java:89)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:38)
at io.reactivex.internal.schedulers.ScheduledDirectTask.call(ScheduledDirectTask.java:26)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:762)
for large size files, quality decreased after editing.
also adding a text decreased all images quality.
Hi Guys,
I've just tried to upload the abb to google play console. Unfortunately it won't allow me to upload.
I've uninstalled the implementation and the new abb uploaded with no problems. But when I reinstall
implementation 'com.github.iamutkarshtiwari:Ananas:1.2.4',
the issue is there again.
Any suggestions on how to look for the conflict/issue?
Cheers
Greetings,
The library is fabulously working till API 28 or Android Pie. But when I run it in Android Q or API 29(or above version). It fails to load the image. Then I decided to look upon the code and I saw the library using BitmapFactory.decodeFile which I think would be difficult to use as Android Q or 10 has curbed Storage Path for User privacy.
From my view, these functions are making trouble for Android 10
utils/BitmapUtils.java
For loading the image:
public static Bitmap getSampledBitmap(String filePath, int reqWidth, int reqHeight) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); options.inPreferredConfig = Bitmap.Config.RGB_565; options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
For saving the image
public static boolean saveBitmap(Bitmap bm, String filePath) { File f = new File(filePath); if (f.exists()) { f.delete(); } try { FileOutputStream out = new FileOutputStream(f); bm.compress(Bitmap.CompressFormat.PNG, 90, out); out.flush(); out.close(); return true; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } }
Putting some reference which might help the library:
For saving an image in Android 10:
https://stackoverflow.com/a/56990305
Plus, putting android:requestLegacyExternalStorage="true"
in Manifest won't be a good idea as Google would enforce in Android R or Android 11.
Please update these code to get compatible with Android 10 or above.
Thank You
The app does show the image in first go. Need to select again.
Add 90 degrees
rotation (clock/anti-clock), left -> right (vice versa)
translations to crop fragment.
Hi, I continually get the error
E/Demo App: Output image path required. Use withOutputPath(path) to provide the output image path.
Using the below:
File storageDir = new File(Environment
.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/Storage/");
try {
Intent intent = new ImageEditorIntentBuilder(this, sourceImagePath, storageDir.toString())
.withAddText() // Add the features you need
.withPaintFeature()
.withFilterFeature()
.withRotateFeature()
.withCropFeature()
.withBrightnessFeature()
.withSaturationFeature()
.withBeautyFeature()
.withStickerFeature()
.forcePortrait(true) // Add this to force portrait mode (It's set to false by default)
.setSupportActionBarVisibility(false) // To hide app's default action bar
.build();
EditImageActivity.start(AdvertiserPageSubmitNew.this, intent, PHOTO_EDITOR_REQUEST_CODE);
} catch (Exception e) {
Log.e("Demo App", e.getMessage()); // This could throw if either `sourcePath` or `outputPath` is blank or Null
}
I apologize if this seems basic. Any assistance would be appreciated
I want to open the Editor and have the brush functionality but i want to use a lower size as a default. Is there any way to do this?
What's the possibility of split the library into modules by feature?, so anybody that wants to use only some features not have to import the whole features.
in mi case i only need 3 features my app size was 12MB with the library now are around 24MB.
I think that split the library on modules it's a really good improvement.
I am in disposition to help with the work.
Best regards.
Ps. sorry for my english.
According to your code, if I want to save the image, it will return to the last activity, and I will get the url in the OnActivityResult. But I want to go to the next activity since the user wants to send a post to the server.
First of all, Your library is very helpful to me.
But now when i pass filePath to EditImageActivity i always this error "Failed to load the image!"
You have used this Toast in this method given below.
Have you updated the code ?
Can you help me in this ?
private void loadImageFromFile(String filePath) {
compositeDisposable.clear();
Disposable loadImageDisposable = loadImage(filePath)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe(subscriber -> loadingDialog.show())
.doFinally(() -> loadingDialog.dismiss())
.subscribe(processedBitmap -> changeMainBitmap(processedBitmap, false), e -> showToast(R.string.iamutkarshtiwari_github_io_ananas_load_error));
compositeDisposable.add(loadImageDisposable);
}
--
Thanks & Regards,
Yatin Julka
Android Developer
When trying to implement this library android studio shows this error.
When I initially open the editor, the image starts rotated at 90 degrees. Why is that?
would you please add zoom function?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.