1
0
mirror of https://github.com/NekoX-Dev/NekoX.git synced 2024-12-17 07:49:34 +01:00

Retry when translate failed

This commit is contained in:
NekoInverter 2020-05-12 20:11:45 +08:00
parent 9fd60bf150
commit 517acf4c17
No known key found for this signature in database
GPG Key ID: 280D6CCCF95715F9
2 changed files with 9 additions and 7 deletions

View File

@ -15332,16 +15332,17 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("TranslateFailed", R.string.TranslateFailed));
builder.setNeutralButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> showDialog(NekoSettingsActivity.getTranslationProviderAlert(getParentActivity())));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.show();
builder.setPositiveButton(LocaleController.getString("Retry", R.string.Retry), (dialog, which) -> processSelectedOption(option));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
@Override
public void onUnsupported() {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("TranslateApiUnsupported", R.string.TranslateApiUnsupported));
builder.setNeutralButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> showDialog(NekoSettingsActivity.getTranslationProviderAlert(getParentActivity())));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setPositiveButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> showDialog(NekoSettingsActivity.getTranslationProviderAlert(getParentActivity())));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
});

View File

@ -73,7 +73,8 @@ public class MessageHelper extends BaseController {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(LocaleController.getString("TranslateFailed", R.string.TranslateFailed));
builder.setNeutralButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> NekoSettingsActivity.getTranslationProviderAlert(context).show());
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setPositiveButton(LocaleController.getString("Retry", R.string.Retry), (dialog, which) -> showTranslateDialog(context, query));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.show();
}
@ -84,8 +85,8 @@ public class MessageHelper extends BaseController {
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(LocaleController.getString("TranslateApiUnsupported", R.string.TranslateApiUnsupported));
builder.setNeutralButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> NekoSettingsActivity.getTranslationProviderAlert(context).show());
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
builder.setPositiveButton(LocaleController.getString("TranslationProvider", R.string.TranslationProvider), (dialog, which) -> NekoSettingsActivity.getTranslationProviderAlert(context).show());
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.show();
}
});