Java Code Examples for org.telegram.messenger.UserConfig#getActivatedAccountsCount()
The following examples show how to use
org.telegram.messenger.UserConfig#getActivatedAccountsCount() .
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: DrawerUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onDraw(Canvas canvas) { if (UserConfig.getActivatedAccountsCount() <= 1 || !NotificationsController.getInstance(accountNumber).showBadgeNumber) { return; } int counter = NotificationsController.getInstance(accountNumber).getTotalUnreadCount(); if (counter <= 0) { return; } String text = String.format("%d", counter); int countTop = AndroidUtilities.dp(12.5f); int textWidth = (int) Math.ceil(Theme.chat_livePaint.measureText(text)); int countWidth = Math.max(AndroidUtilities.dp(12), textWidth); int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25); int x = countLeft - AndroidUtilities.dp(5.5f); rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(11), countTop + AndroidUtilities.dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.dialogs_countPaint); canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2 - AndroidUtilities.dp(0.5f), countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); }
Example 2
Source File: DrawerUserCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onDraw(Canvas canvas) { if (UserConfig.getActivatedAccountsCount() <= 1 || !NotificationsController.getInstance(accountNumber).showBadgeNumber) { return; } int counter = NotificationsController.getInstance(accountNumber).getTotalUnreadCount(); if (counter <= 0) { return; } String text = String.format("%d", counter); int countTop = AndroidUtilities.dp(12.5f); int textWidth = (int) Math.ceil(Theme.chat_livePaint.measureText(text)); int countWidth = Math.max(AndroidUtilities.dp(12), textWidth); int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25); int x = countLeft - AndroidUtilities.dp(5.5f); rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(11), countTop + AndroidUtilities.dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.dialogs_countPaint); canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2 - AndroidUtilities.dp(0.5f), countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); }
Example 3
Source File: LogoutActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override public boolean onFragmentCreate() { super.onFragmentCreate(); rowCount = 0; alternativeHeaderRow = rowCount++; if (UserConfig.getActivatedAccountsCount() < UserConfig.MAX_ACCOUNT_COUNT) { addAccountRow = rowCount++; } else { addAccountRow = -1; } if (SharedConfig.passcodeHash.length() <= 0) { passcodeRow = rowCount++; } else { passcodeRow = -1; } cacheRow = rowCount++; phoneRow = rowCount++; supportRow = rowCount++; alternativeSectionRow = rowCount++; logoutRow = rowCount++; logoutSectionRow = rowCount++; return true; }
Example 4
Source File: DrawerUserCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onDraw(Canvas canvas) { if (UserConfig.getActivatedAccountsCount() <= 1 || !NotificationsController.getInstance(accountNumber).showBadgeNumber) { return; } int counter = NotificationsController.getInstance(accountNumber).getTotalUnreadCount(); if (counter <= 0) { return; } String text = String.format("%d", counter); int countTop = AndroidUtilities.dp(12.5f); int textWidth = (int) Math.ceil(Theme.dialogs_countTextPaint.measureText(text)); int countWidth = Math.max(AndroidUtilities.dp(10), textWidth); int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25); int x = countLeft - AndroidUtilities.dp(5.5f); rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(14), countTop + AndroidUtilities.dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.dialogs_countPaint); canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2, countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); }
Example 5
Source File: LogoutActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override public boolean onFragmentCreate() { super.onFragmentCreate(); rowCount = 0; alternativeHeaderRow = rowCount++; if (UserConfig.getActivatedAccountsCount() < UserConfig.MAX_ACCOUNT_COUNT) { addAccountRow = rowCount++; } else { addAccountRow = -1; } if (SharedConfig.passcodeHash.length() <= 0) { passcodeRow = rowCount++; } else { passcodeRow = -1; } cacheRow = rowCount++; phoneRow = rowCount++; supportRow = rowCount++; alternativeSectionRow = rowCount++; logoutRow = rowCount++; logoutSectionRow = rowCount++; return true; }
Example 6
Source File: DrawerUserCell.java From Telegram with GNU General Public License v2.0 | 6 votes |
@Override protected void onDraw(Canvas canvas) { if (UserConfig.getActivatedAccountsCount() <= 1 || !NotificationsController.getInstance(accountNumber).showBadgeNumber) { return; } int counter = NotificationsController.getInstance(accountNumber).getTotalUnreadCount(); if (counter <= 0) { return; } String text = String.format("%d", counter); int countTop = AndroidUtilities.dp(12.5f); int textWidth = (int) Math.ceil(Theme.dialogs_countTextPaint.measureText(text)); int countWidth = Math.max(AndroidUtilities.dp(10), textWidth); int countLeft = getMeasuredWidth() - countWidth - AndroidUtilities.dp(25); int x = countLeft - AndroidUtilities.dp(5.5f); rect.set(x, countTop, x + countWidth + AndroidUtilities.dp(14), countTop + AndroidUtilities.dp(23)); canvas.drawRoundRect(rect, 11.5f * AndroidUtilities.density, 11.5f * AndroidUtilities.density, Theme.dialogs_countPaint); canvas.drawText(text, rect.left + (rect.width() - textWidth) / 2, countTop + AndroidUtilities.dp(16), Theme.dialogs_countTextPaint); }
Example 7
Source File: DrawerLayoutAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DrawerLayoutAdapter(Context context) { mContext = context; accountsShowed = UserConfig.getActivatedAccountsCount() > 1 && MessagesController.getGlobalMainSettings().getBoolean("accountsShowed", true); Theme.createDialogsResources(context); resetItems(); }
Example 8
Source File: DrawerLayoutAdapter.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
public DrawerLayoutAdapter(Context context) { mContext = context; accountsShowed = UserConfig.getActivatedAccountsCount() > 1 && MessagesController.getGlobalMainSettings().getBoolean("accountsShowed", true); Theme.createDialogsResources(context); resetItems(); }
Example 9
Source File: DrawerLayoutAdapter.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public DrawerLayoutAdapter(Context context, SideMenultItemAnimator animator) { mContext = context; itemAnimator = animator; accountsShown = UserConfig.getActivatedAccountsCount() > 1 && MessagesController.getGlobalMainSettings().getBoolean("accountsShown", true); Theme.createDialogsResources(context); resetItems(); }
Example 10
Source File: AlertsCreator.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
public static AlertDialog createAccountSelectDialog(Activity parentActivity, final AccountSelectDelegate delegate) { if (UserConfig.getActivatedAccountsCount() < 2) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); final Runnable dismissRunnable = builder.getDismissRunnable(); final AlertDialog[] alertDialog = new AlertDialog[1]; final LinearLayout linearLayout = new LinearLayout(parentActivity); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { TLRPC.User u = UserConfig.getInstance(a).getCurrentUser(); if (u != null) { AccountSelectCell cell = new AccountSelectCell(parentActivity); cell.setAccount(a, false); cell.setPadding(AndroidUtilities.dp(14), 0, AndroidUtilities.dp(14), 0); cell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); cell.setOnClickListener(v -> { if (alertDialog[0] != null) { alertDialog[0].setOnDismissListener(null); } dismissRunnable.run(); AccountSelectCell cell1 = (AccountSelectCell) v; delegate.didSelectAccount(cell1.getAccountNumber()); }); } } builder.setTitle(LocaleController.getString("SelectAccount", R.string.SelectAccount)); builder.setView(linearLayout); builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null); return alertDialog[0] = builder.create(); }
Example 11
Source File: DrawerLayoutAdapter.java From Telegram with GNU General Public License v2.0 | 5 votes |
public DrawerLayoutAdapter(Context context, SideMenultItemAnimator animator) { mContext = context; itemAnimator = animator; accountsShown = UserConfig.getActivatedAccountsCount() > 1 && MessagesController.getGlobalMainSettings().getBoolean("accountsShown", true); Theme.createDialogsResources(context); resetItems(); }
Example 12
Source File: AlertsCreator.java From Telegram with GNU General Public License v2.0 | 5 votes |
public static AlertDialog createAccountSelectDialog(Activity parentActivity, final AccountSelectDelegate delegate) { if (UserConfig.getActivatedAccountsCount() < 2) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); final Runnable dismissRunnable = builder.getDismissRunnable(); final AlertDialog[] alertDialog = new AlertDialog[1]; final LinearLayout linearLayout = new LinearLayout(parentActivity); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { TLRPC.User u = UserConfig.getInstance(a).getCurrentUser(); if (u != null) { AccountSelectCell cell = new AccountSelectCell(parentActivity); cell.setAccount(a, false); cell.setPadding(AndroidUtilities.dp(14), 0, AndroidUtilities.dp(14), 0); cell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50)); cell.setOnClickListener(v -> { if (alertDialog[0] != null) { alertDialog[0].setOnDismissListener(null); } dismissRunnable.run(); AccountSelectCell cell1 = (AccountSelectCell) v; delegate.didSelectAccount(cell1.getAccountNumber()); }); } } builder.setTitle(LocaleController.getString("SelectAccount", R.string.SelectAccount)); builder.setView(linearLayout); builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null); return alertDialog[0] = builder.create(); }
Example 13
Source File: AlertsCreator.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public static AlertDialog createAccountSelectDialog(Activity parentActivity, final AccountSelectDelegate delegate) { if (UserConfig.getActivatedAccountsCount() < 2) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); final Runnable dismissRunnable = builder.getDismissRunnable(); final AlertDialog[] alertDialog = new AlertDialog[1]; final LinearLayout linearLayout = new LinearLayout(parentActivity); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { TLRPC.User u = UserConfig.getInstance(a).getCurrentUser(); if (u != null) { AccountSelectCell cell = new AccountSelectCell(parentActivity); cell.setAccount(a, false); cell.setPadding(AndroidUtilities.dp(14), 0, AndroidUtilities.dp(14), 0); cell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); cell.setOnClickListener(v -> { if (alertDialog[0] != null) { alertDialog[0].setOnDismissListener(null); } dismissRunnable.run(); AccountSelectCell cell1 = (AccountSelectCell) v; delegate.didSelectAccount(cell1.getAccountNumber()); }); } } builder.setTitle(LocaleController.getString("SelectAccount", R.string.SelectAccount)); builder.setView(linearLayout); builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null); return alertDialog[0] = builder.create(); }
Example 14
Source File: AlertsCreator.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
public static AlertDialog createAccountSelectDialog(Activity parentActivity, final AccountSelectDelegate delegate) { if (UserConfig.getActivatedAccountsCount() < 2) { return null; } AlertDialog.Builder builder = new AlertDialog.Builder(parentActivity); final Runnable dismissRunnable = builder.getDismissRunnable(); final AlertDialog[] alertDialog = new AlertDialog[1]; final LinearLayout linearLayout = new LinearLayout(parentActivity); linearLayout.setOrientation(LinearLayout.VERTICAL); for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { TLRPC.User u = UserConfig.getInstance(a).getCurrentUser(); if (u != null) { AccountSelectCell cell = new AccountSelectCell(parentActivity); cell.setAccount(a, false); cell.setPadding(AndroidUtilities.dp(14), 0, AndroidUtilities.dp(14), 0); cell.setBackgroundDrawable(Theme.getSelectorDrawable(false)); linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); cell.setOnClickListener(v -> { if (alertDialog[0] != null) { alertDialog[0].setOnDismissListener(null); } dismissRunnable.run(); AccountSelectCell cell1 = (AccountSelectCell) v; delegate.didSelectAccount(cell1.getAccountNumber()); }); } } builder.setTitle(LocaleController.getString("SelectAccount", R.string.SelectAccount)); builder.setView(linearLayout); builder.setPositiveButton(LocaleController.getString("Cancel", R.string.Cancel), null); return alertDialog[0] = builder.create(); }
Example 15
Source File: NotificationsSettingsActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public boolean onFragmentCreate() { MessagesController.getInstance(currentAccount).loadSignUpNotificationsSettings(); loadExceptions(); if (UserConfig.getActivatedAccountsCount() > 1) { accountsSectionRow = rowCount++; accountsAllRow = rowCount++; accountsInfoRow = rowCount++; } else { accountsSectionRow = -1; accountsAllRow = -1; accountsInfoRow = -1; } notificationsSectionRow = rowCount++; privateRow = rowCount++; groupRow = rowCount++; channelsRow = rowCount++; notificationsSection2Row = rowCount++; callsSectionRow = rowCount++; callsVibrateRow = rowCount++; callsRingtoneRow = rowCount++; eventsSection2Row = rowCount++; badgeNumberSection = rowCount++; badgeNumberShowRow = rowCount++; badgeNumberMutedRow = rowCount++; badgeNumberMessagesRow = rowCount++; badgeNumberSection2Row = rowCount++; inappSectionRow = rowCount++; inappSoundRow = rowCount++; inappVibrateRow = rowCount++; inappPreviewRow = rowCount++; inchatSoundRow = rowCount++; if (Build.VERSION.SDK_INT >= 21) { inappPriorityRow = rowCount++; } else { inappPriorityRow = -1; } callsSection2Row = rowCount++; eventsSectionRow = rowCount++; contactJoinedRow = rowCount++; pinnedMessageRow = rowCount++; otherSection2Row = rowCount++; otherSectionRow = rowCount++; notificationsServiceConnectionRow = rowCount++; androidAutoAlertRow = -1; repeatRow = rowCount++; resetSection2Row = rowCount++; resetSectionRow = rowCount++; resetNotificationsRow = rowCount++; resetNotificationsSectionRow = rowCount++; NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.notificationsSettingsUpdated); return super.onFragmentCreate(); }
Example 16
Source File: NotificationsSettingsActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public boolean onFragmentCreate() { MessagesController.getInstance(currentAccount).loadSignUpNotificationsSettings(); loadExceptions(); if (UserConfig.getActivatedAccountsCount() > 1) { accountsSectionRow = rowCount++; accountsAllRow = rowCount++; accountsInfoRow = rowCount++; } else { accountsSectionRow = -1; accountsAllRow = -1; accountsInfoRow = -1; } notificationsSectionRow = rowCount++; privateRow = rowCount++; groupRow = rowCount++; channelsRow = rowCount++; notificationsSection2Row = rowCount++; callsSectionRow = rowCount++; callsVibrateRow = rowCount++; callsRingtoneRow = rowCount++; eventsSection2Row = rowCount++; badgeNumberSection = rowCount++; badgeNumberShowRow = rowCount++; badgeNumberMutedRow = rowCount++; badgeNumberMessagesRow = rowCount++; badgeNumberSection2Row = rowCount++; inappSectionRow = rowCount++; inappSoundRow = rowCount++; inappVibrateRow = rowCount++; inappPreviewRow = rowCount++; inchatSoundRow = rowCount++; if (Build.VERSION.SDK_INT >= 21) { inappPriorityRow = rowCount++; } else { inappPriorityRow = -1; } callsSection2Row = rowCount++; eventsSectionRow = rowCount++; contactJoinedRow = rowCount++; pinnedMessageRow = rowCount++; otherSection2Row = rowCount++; otherSectionRow = rowCount++; notificationsServiceRow = rowCount++; notificationsServiceConnectionRow = rowCount++; androidAutoAlertRow = -1; repeatRow = rowCount++; resetSection2Row = rowCount++; resetSectionRow = rowCount++; resetNotificationsRow = rowCount++; resetNotificationsSectionRow = rowCount++; NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.notificationsSettingsUpdated); return super.onFragmentCreate(); }