-
-
Notifications
You must be signed in to change notification settings - Fork 45
Improve logging around resizing in QuestionsView #3370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,8 @@ | |
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
|
|
||
| /** | ||
| * @author carlhartung | ||
| */ | ||
|
|
@@ -346,6 +348,30 @@ public void setFocus(Context context, int indexOfLastChangedWidget) { | |
| } | ||
| } | ||
|
|
||
| @Override | ||
| protected void onSizeChanged(int w, int h, int oldw, int oldh) { | ||
| try { | ||
| super.onSizeChanged(w, h, oldw, oldh); | ||
| } catch (IllegalArgumentException e) { | ||
| Logger.log(LogTypes.SOFT_ASSERT, | ||
| "Resizing from " + oldw + "X" + oldh + " to " + w + "X" + h + " failed with focus on: " + getFocusedViewClassName()); | ||
| throw e; | ||
| } | ||
| } | ||
|
|
||
| @NonNull | ||
| private String getFocusedViewClassName() { | ||
| View focusedView = findFocus(); | ||
| String focusedViewClassName = "None"; | ||
| if (focusedView != null) { | ||
| focusedViewClassName = focusedView.getClass().toString(); | ||
| if (focusedView.getParent() != null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What can be parent of QuestionView ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The parent here is of the view who has the focus which is likely to be a
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, in case I think you can use simple class name by |
||
| focusedViewClassName += "/"+ focusedView.getParent().getClass(); | ||
| } | ||
| } | ||
| return focusedViewClassName; | ||
| } | ||
|
|
||
| private void scrollToWidget(final QuestionWidget widget) { | ||
| new Handler().post(() -> QuestionsView.this.scrollTo(0, widget.getTop())); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Log exception as it will gives exception details also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We rethrow the exception, so the crashes will continue to happen and we will be able to get the details from the crash reports. But I'm happy to send add these to the log as well.