-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Increasing flexibility of CrashDialog #502
Conversation
@@ -39,6 +39,15 @@ | |||
<uses-sdk android:minSdkVersion="8"/> | |||
|
|||
<application> | |||
<!--suppress AndroidDomInspection --> | |||
<activity | |||
android:name="org.acra.CrashReportDialogImpl" |
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.
What is org.acra.CrashReportDialogImpl?
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.
A generated class which extends the class annotated with @AcraDialog, if there is one.
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.
Example:
This is an (admittedly useless) simple implementation using a different superclass
@AcraDialog
public abstract class MyCrashReportDialog extends AppCompatActivity implements ICrashReportDialog {
@Override
public void init(@Nullable Bundle savedInstanceState) {
Toast.makeText(this, "This is a CrashReportDialog", Toast.LENGTH_SHORT).show();
sendCrash(null, null);
}
}
The compiler will now generate this for it:
public final class CrashReportDialogImpl extends MyCrashReportDialog {
private final CrashReportDelegate delegate;
public CrashReportDialogImpl() {
delegate = new CrashReportDelegate(this);
}
@Override
public void onCreate(Bundle arg0) {
super.onCreate(arg0);
if(delegate.loadFromIntent(getIntent())) {
init(arg0);
}
else {
finish();
}
}
@Override
public void cancelReports() {
delegate.cancelReports();
}
@Override
public void sendCrash(@Nullable String arg0, @Nullable String arg1) {
delegate.sendCrash(arg0, arg1);
}
@Override
public ACRAConfiguration getConfig() {
return delegate.getConfig();
}
@Override
public Throwable getException() {
return delegate.getException();
}
}
Yes and yes. Users can choose any subclass of activity for their CrashReportDialog. They will have to use the compiler though. |
I don't understand how this is supposed to work at all. There is nothing here that will generate CrashReportDialogImpl. |
No, annotations cannot do that. Annotation processors can. |
But the annotation processor is not referenced anywhere within ACRA. |
Currently the user has to add a separate dependency. I'll investigate what happens if Acra references it directly. |
If the dependency is added in acra, it has to be compiled. This adds an unnecessary 700kb to the final apk, which is not acceptable. So, I'll go with the separate dependency. |
See #489. This is now fully backwards compatible, so it does no harm.