Fix crash
This commit is contained in:
parent
f894de15d8
commit
31072e7095
@ -1563,53 +1563,55 @@ public class ChatMessageCell extends BaseCell implements SeekBar.SeekBarDelegate
|
|||||||
if (pressedBotButton != -1) {
|
if (pressedBotButton != -1) {
|
||||||
BotButton button = botButtons.get(pressedBotButton);
|
BotButton button = botButtons.get(pressedBotButton);
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
if (!TextUtils.isEmpty(button.button.url)) {
|
if (button.button != null) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
if (!TextUtils.isEmpty(button.button.url)) {
|
||||||
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("CopyLink", R.string.CopyLink), LocaleController.getString("CopyDetails", R.string.CopyDetails)}, (dialogInterface, i) -> {
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||||
if (i == 0) {
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("CopyLink", R.string.CopyLink), LocaleController.getString("CopyDetails", R.string.CopyDetails)}, (dialogInterface, i) -> {
|
||||||
try {
|
if (i == 0) {
|
||||||
AndroidUtilities.addToClipboard(button.button.text);
|
try {
|
||||||
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
AndroidUtilities.addToClipboard(button.button.text);
|
||||||
} catch (Exception e) {
|
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
||||||
FileLog.e(e);
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
} else if (i == 1) {
|
||||||
|
try {
|
||||||
|
AndroidUtilities.addToClipboard(button.button.url);
|
||||||
|
Toast.makeText(getContext(), LocaleController.getString("LinkCopied", R.string.LinkCopied), Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
} else if (i == 2) {
|
||||||
|
try {
|
||||||
|
AndroidUtilities.addToClipboard(gson.toJson(button.button));
|
||||||
|
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (i == 1) {
|
});
|
||||||
try {
|
builder.show();
|
||||||
AndroidUtilities.addToClipboard(button.button.url);
|
} else {
|
||||||
Toast.makeText(getContext(), LocaleController.getString("LinkCopied", R.string.LinkCopied), Toast.LENGTH_SHORT).show();
|
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||||
} catch (Exception e) {
|
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("CopyDetails", R.string.CopyDetails)}, (dialogInterface, i) -> {
|
||||||
FileLog.e(e);
|
if (i == 0) {
|
||||||
|
try {
|
||||||
|
AndroidUtilities.addToClipboard(button.button.text);
|
||||||
|
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
|
} else if (i == 1) {
|
||||||
|
try {
|
||||||
|
AndroidUtilities.addToClipboard(gson.toJson(button.button));
|
||||||
|
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (Exception e) {
|
||||||
|
FileLog.e(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (i == 2) {
|
});
|
||||||
try {
|
builder.show();
|
||||||
AndroidUtilities.addToClipboard(gson.toJson(button.button));
|
}
|
||||||
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.show();
|
|
||||||
} else {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
|
||||||
builder.setItems(new CharSequence[]{LocaleController.getString("Copy", R.string.Copy), LocaleController.getString("CopyDetails", R.string.CopyDetails)}, (dialogInterface, i) -> {
|
|
||||||
if (i == 0) {
|
|
||||||
try {
|
|
||||||
AndroidUtilities.addToClipboard(button.button.text);
|
|
||||||
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
} else if (i == 1) {
|
|
||||||
try {
|
|
||||||
AndroidUtilities.addToClipboard(gson.toJson(button.button));
|
|
||||||
Toast.makeText(getContext(), LocaleController.getString("TextCopied", R.string.TextCopied), Toast.LENGTH_SHORT).show();
|
|
||||||
} catch (Exception e) {
|
|
||||||
FileLog.e(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
builder.show();
|
|
||||||
}
|
}
|
||||||
pressedBotButton = -1;
|
pressedBotButton = -1;
|
||||||
invalidate();
|
invalidate();
|
||||||
|
Loading…
Reference in New Issue
Block a user