You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
some fixes to make NewPipe not crash when layouting
This commit is contained in:
@@ -18,6 +18,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
||||
private native void nativeShow(long ptr);
|
||||
|
||||
public AlertDialog(Context context) {
|
||||
super(context, 0);
|
||||
nativePtr = nativeInit();
|
||||
}
|
||||
|
||||
@@ -25,10 +26,6 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
||||
nativeSetTitle(nativePtr, String.valueOf(title));
|
||||
}
|
||||
|
||||
public void setOnCancelListener(OnCancelListener onCancelListener) {}
|
||||
|
||||
public void setCancelable(boolean cancelable) {}
|
||||
|
||||
public void setMessage(CharSequence message) {
|
||||
System.out.println("AlertDialog setMessage called with: '" + message + "'");
|
||||
nativeSetMessage(nativePtr, String.valueOf(message));
|
||||
@@ -54,17 +51,15 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private Context context;
|
||||
private AlertDialog dialog;
|
||||
|
||||
public Builder(Context context) {
|
||||
System.out.println("making an AlertDialog$Builder as we speak, my word!");
|
||||
this.context = context;
|
||||
dialog = new AlertDialog(context);
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener) {
|
||||
return setPositiveButton(context.getResources().getText(textId), listener);
|
||||
return setPositiveButton(dialog.getContext().getText(textId), listener);
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener) {
|
||||
@@ -88,7 +83,7 @@ public class AlertDialog extends Dialog implements DialogInterface {
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setTitle(int title) {
|
||||
return setTitle(context.getResources().getText(title));
|
||||
return setTitle(dialog.getContext().getText(title));
|
||||
}
|
||||
|
||||
public AlertDialog.Builder setMessage(CharSequence message) {
|
||||
|
||||
Reference in New Issue
Block a user