Add copy to url alert

(cherry picked from commit 54d471bd67f36d41790da8e03b2af54aaa3e53cc)
This commit is contained in:
NekoInverter 2020-06-21 12:37:07 +08:00 committed by 世界
parent ddf1841ed1
commit ea0e850344
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
1 changed files with 9 additions and 1 deletions

View File

@ -459,7 +459,7 @@ public class AlertsCreator {
return null;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title == null ? LocaleController.getString("NekoX", R.string.NekoX) : title);
builder.setTitle(title == null ? LocaleController.getString("AppName", R.string.AppName) : title);
builder.setMessage(text);
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
return builder;
@ -847,6 +847,14 @@ public class AlertsCreator {
builder.setMessageTextViewClickable(false);
builder.setPositiveButton(LocaleController.getString("Open", R.string.Open), (dialogInterface, i) -> Browser.openUrl(fragment.getParentActivity(), url, inlineReturn == 0, tryTelegraph));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setNeutralButton(LocaleController.getString("Copy", R.string.Copy), (dialogInterface, i) -> {
try {
AndroidUtilities.addToClipboard(url);
Toast.makeText(fragment.getParentActivity(), LocaleController.getString("LinkCopied", R.string.LinkCopied), Toast.LENGTH_SHORT).show();
} catch (Exception e) {
FileLog.e(e);
}
});
fragment.showDialog(builder.create());
}
}