Java Code Examples for org.telegram.messenger.MessageObject#addEntitiesToText()
The following examples show how to use
org.telegram.messenger.MessageObject#addEntitiesToText() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockingUpdateView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void show(int account, TLRPC.TL_help_appUpdate update) { pressCount = 0; appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(update.text); MessageObject.addEntitiesToText(builder, update.entities, false, 0, false, false, false); textView.setText(builder); if (update.document instanceof TLRPC.TL_document) { acceptTextView.setText(LocaleController.getString("Update", R.string.Update).toUpperCase() + String.format(Locale.US, " (%1$s)", AndroidUtilities.formatFileSize(update.document.size))); } else { acceptTextView.setText(LocaleController.getString("Update", R.string.Update).toUpperCase()); } NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileDidLoaded); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileDidFailedLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileLoadProgressChanged); }
Example 2
Source File: BlockingUpdateView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
public void show(int account, TLRPC.TL_help_appUpdate update) { pressCount = 0; appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(update.text); MessageObject.addEntitiesToText(builder, update.entities, false, 0, false, false, false); textView.setText(builder); if (update.document instanceof TLRPC.TL_document) { acceptTextView.setText(LocaleController.getString("Update", R.string.Update).toUpperCase() + String.format(Locale.US, " (%1$s)", AndroidUtilities.formatFileSize(update.document.size))); } else { acceptTextView.setText(LocaleController.getString("Update", R.string.Update).toUpperCase()); } NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileDidLoaded); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileDidFailedLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileLoadProgressChanged); }
Example 3
Source File: TermsOfServiceView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void show(int account, TLRPC.TL_help_termsOfService tos) { if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(tos.text); MessageObject.addEntitiesToText(builder, tos.entities, false, 0, false, false, false); textView.setText(builder); currentTos = tos; currentAccount = account; }
Example 4
Source File: TermsOfServiceView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public void show(int account, TLRPC.TL_help_termsOfService tos) { if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(tos.text); MessageObject.addEntitiesToText(builder, tos.entities, false, 0, false, false, false); textView.setText(builder); currentTos = tos; currentAccount = account; }
Example 5
Source File: TermsOfServiceView.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public void show(int account, TLRPC.TL_help_termsOfService tos) { if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(tos.text); MessageObject.addEntitiesToText(builder, tos.entities, false, false, false, false); addBulletsToText(builder, '-', AndroidUtilities.dp(10f), 0xff50a8eb, AndroidUtilities.dp(4f)); textView.setText(builder); currentTos = tos; currentAccount = account; }
Example 6
Source File: TermsOfServiceView.java From Telegram with GNU General Public License v2.0 | 5 votes |
public void show(int account, TLRPC.TL_help_termsOfService tos) { if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(tos.text); MessageObject.addEntitiesToText(builder, tos.entities, false, false, false, false); addBulletsToText(builder, '-', AndroidUtilities.dp(10f), 0xff50a8eb, AndroidUtilities.dp(4f)); textView.setText(builder); currentTos = tos; currentAccount = account; }
Example 7
Source File: LoginActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void showTermsOfService(boolean needAccept) { if (currentTermsOfService == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService)); if (needAccept) { builder.setPositiveButton(LocaleController.getString("Accept", R.string.Accept), (dialog, which) -> { currentTermsOfService.popup = false; onNextPressed(); }); builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog, which) -> { AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity()); builder1.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService)); builder1.setMessage(LocaleController.getString("TosDecline", R.string.TosDecline)); builder1.setPositiveButton(LocaleController.getString("SignUp", R.string.SignUp), (dialog1, which1) -> { currentTermsOfService.popup = false; onNextPressed(); }); builder1.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog12, which12) -> wrongNumber.callOnClick()); showDialog(builder1.create()); }); } else { builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); } SpannableStringBuilder text = new SpannableStringBuilder(currentTermsOfService.text); MessageObject.addEntitiesToText(text, currentTermsOfService.entities, false, 0, false, false, false); builder.setMessage(text); showDialog(builder.create()); }
Example 8
Source File: LoginActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void showTermsOfService(boolean needAccept) { if (currentTermsOfService == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService)); if (needAccept) { builder.setPositiveButton(LocaleController.getString("Accept", R.string.Accept), (dialog, which) -> { currentTermsOfService.popup = false; onNextPressed(); }); builder.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog, which) -> { AlertDialog.Builder builder1 = new AlertDialog.Builder(getParentActivity()); builder1.setTitle(LocaleController.getString("TermsOfService", R.string.TermsOfService)); builder1.setMessage(LocaleController.getString("TosDecline", R.string.TosDecline)); builder1.setPositiveButton(LocaleController.getString("SignUp", R.string.SignUp), (dialog1, which1) -> { currentTermsOfService.popup = false; onNextPressed(); }); builder1.setNegativeButton(LocaleController.getString("Decline", R.string.Decline), (dialog12, which12) -> wrongNumber.callOnClick()); showDialog(builder1.create()); }); } else { builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null); } SpannableStringBuilder text = new SpannableStringBuilder(currentTermsOfService.text); MessageObject.addEntitiesToText(text, currentTermsOfService.entities, false, 0, false, false, false); builder.setMessage(text); showDialog(builder.create()); }
Example 9
Source File: BlockingUpdateView.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public void show(int account, TLRPC.TL_help_appUpdate update, boolean check) { pressCount = 0; appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(update.text); MessageObject.addEntitiesToText(builder, update.entities, false, false, false, false); textView.setText(builder); if (update.document instanceof TLRPC.TL_document) { acceptTextView.setText(LocaleController.getString("Update", R.string.Update) + String.format(Locale.US, " (%1$s)", AndroidUtilities.formatFileSize(update.document.size))); } else { acceptTextView.setText(LocaleController.getString("Update", R.string.Update)); } NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.fileDidLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.fileDidFailToLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileLoadProgressChanged); if (check) { TLRPC.TL_help_getAppUpdate req = new TLRPC.TL_help_getAppUpdate(); try { req.source = ApplicationLoader.applicationContext.getPackageManager().getInstallerPackageName(ApplicationLoader.applicationContext.getPackageName()); } catch (Exception ignore) { } if (req.source == null) { req.source = ""; } ConnectionsManager.getInstance(accountNum).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response instanceof TLRPC.TL_help_appUpdate) { final TLRPC.TL_help_appUpdate res = (TLRPC.TL_help_appUpdate) response; if (!res.can_not_skip) { setVisibility(GONE); UserConfig.getInstance(0).pendingAppUpdate = null; UserConfig.getInstance(0).saveConfig(false); } } })); } }
Example 10
Source File: BlockingUpdateView.java From Telegram with GNU General Public License v2.0 | 4 votes |
public void show(int account, TLRPC.TL_help_appUpdate update, boolean check) { pressCount = 0; appUpdate = update; accountNum = account; if (update.document instanceof TLRPC.TL_document) { fileName = FileLoader.getAttachFileName(update.document); } if (getVisibility() != VISIBLE) { setVisibility(VISIBLE); } SpannableStringBuilder builder = new SpannableStringBuilder(update.text); MessageObject.addEntitiesToText(builder, update.entities, false, false, false, false); textView.setText(builder); if (update.document instanceof TLRPC.TL_document) { acceptTextView.setText(LocaleController.getString("Update", R.string.Update) + String.format(Locale.US, " (%1$s)", AndroidUtilities.formatFileSize(update.document.size))); } else { acceptTextView.setText(LocaleController.getString("Update", R.string.Update)); } NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.fileDidLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.fileDidFailToLoad); NotificationCenter.getInstance(accountNum).addObserver(this, NotificationCenter.FileLoadProgressChanged); if (check) { TLRPC.TL_help_getAppUpdate req = new TLRPC.TL_help_getAppUpdate(); try { req.source = ApplicationLoader.applicationContext.getPackageManager().getInstallerPackageName(ApplicationLoader.applicationContext.getPackageName()); } catch (Exception ignore) { } if (req.source == null) { req.source = ""; } ConnectionsManager.getInstance(accountNum).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> { if (response instanceof TLRPC.TL_help_appUpdate) { final TLRPC.TL_help_appUpdate res = (TLRPC.TL_help_appUpdate) response; if (!res.can_not_skip) { setVisibility(GONE); UserConfig.getInstance(0).pendingAppUpdate = null; UserConfig.getInstance(0).saveConfig(false); } } })); } }