Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Optimize #84

Merged
merged 1 commit into from Dec 27, 2016
Merged

Optimize #84

merged 1 commit into from Dec 27, 2016

Conversation

bytewired
Copy link
Contributor

@bytewired bytewired commented Dec 26, 2016

I added optimizable fixes, for bugs that i got in production

// redraw the image by invalidating the container
imageGetter.container.invalidate();
// re-set text to fix images overlapping text
imageGetter.container.setText(imageGetter.container.getText());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what this change does? I was under the impression that the order of these method calls matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's attempt to avoid ArrayOutOfBoundException, but I not sure that it's help

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, can you make these two commits two separate pull requests? I will definitely merge the OutOfMemory fix, the other one needs more testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, no problem. This is stacktrace for ArrayOutOfBoundException, may be it's help:

Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=116; index=852
       at android.text.MeasuredText.addStyleRun(MeasuredText.java:168)
       at android.text.MeasuredText.addStyleRun(MeasuredText.java:204)
       at android.text.StaticLayout.generate(StaticLayout.java:281)
       at android.text.DynamicLayout.reflow(DynamicLayout.java:284)
       at android.text.DynamicLayout.<init>(DynamicLayout.java:170)
       at android.widget.TextView.makeSingleLayout(TextView.java:5999)
       at android.widget.TextView.makeNewLayout(TextView.java:5897)
       at android.widget.TextView.checkForRelayout(TextView.java:6436)
       at android.widget.TextView.setText(TextView.java:3703)
       at android.widget.TextView.setText(TextView.java:3561)
       at android.widget.TextView.setText(TextView.java:3536)
       at org.sufficientlysecure.htmltextview.HtmlHttpImageGetter$ImageGetterAsyncTask.onPostExecute(HtmlHttpImageGetter.java:123)
       at org.sufficientlysecure.htmltextview.HtmlHttpImageGetter$ImageGetterAsyncTask.onPostExecute(HtmlHttpImageGetter.java:79)
       at android.os.AsyncTask.finish(AsyncTask.java:631)
       at android.os.AsyncTask.access$600(AsyncTask.java:177)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loop(Looper.java:153)
       at android.app.ActivityThread.main(ActivityThread.java:5108)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:511)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:751)
       at dalvik.system.NativeStart.main(NativeStart.java)

@dschuermann dschuermann merged commit 33acfc0 into SufficientlySecure:master Dec 27, 2016
@dschuermann
Copy link
Member

Great thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants