Java Code Examples for org.telegram.ui.Cells.TextInfoPrivacyCell#setBackgroundDrawable()
The following examples show how to use
org.telegram.ui.Cells.TextInfoPrivacyCell#setBackgroundDrawable() .
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: ConvertGroupActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == convertRow) { textCell.setText(LocaleController.getString("ConvertGroup", R.string.ConvertGroup), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == convertInfoRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ConvertGroupInfo2", R.string.ConvertGroupInfo2))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == convertDetailRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ConvertGroupInfo3", R.string.ConvertGroupInfo3))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 2
Source File: ConvertGroupActivity.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == convertRow) { textCell.setText(LocaleController.getString("ConvertGroup", R.string.ConvertGroup), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == convertInfoRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ConvertGroupInfo2", R.string.ConvertGroupInfo2))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == convertDetailRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("ConvertGroupInfo3", R.string.ConvertGroupInfo3))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 3
Source File: GroupInviteActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == copyLinkRow) { textCell.setText(LocaleController.getString("CopyLink", R.string.CopyLink), true); } else if (position == shareLinkRow) { textCell.setText(LocaleController.getString("ShareLink", R.string.ShareLink), false); } else if (position == revokeLinkRow) { textCell.setText(LocaleController.getString("RevokeLink", R.string.RevokeLink), true); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == shadowRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == linkInfoRow) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id); if (ChatObject.isChannel(chat) && !chat.megagroup) { privacyCell.setText(LocaleController.getString("ChannelLinkInfo", R.string.ChannelLinkInfo)); } else { privacyCell.setText(LocaleController.getString("LinkInfo", R.string.LinkInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: TextBlockCell textBlockCell = (TextBlockCell) holder.itemView; textBlockCell.setText(invite != null ? invite.link : "error", false); break; } }
Example 4
Source File: SetAdminsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextCheckCell checkCell = (TextCheckCell) holder.itemView; chat = MessagesController.getInstance(currentAccount).getChat(chat_id); checkCell.setTextAndCheck(LocaleController.getString("SetAdminsAll", R.string.SetAdminsAll), chat != null && !chat.admins_enabled, false); break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == allAdminsInfoRow) { if (chat.admins_enabled) { privacyCell.setText(LocaleController.getString("SetAdminsNotAllInfo", R.string.SetAdminsNotAllInfo)); } else { privacyCell.setText(LocaleController.getString("SetAdminsAllInfo", R.string.SetAdminsAllInfo)); } if (usersStartRow != -1) { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } else if (position == usersEndRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: UserCell userCell = (UserCell) holder.itemView; TLRPC.ChatParticipant part = participants.get(position - usersStartRow); TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(part.user_id); userCell.setData(user, null, null, 0); chat = MessagesController.getInstance(currentAccount).getChat(chat_id); userCell.setChecked(!(part instanceof TLRPC.TL_chatParticipant) || chat != null && !chat.admins_enabled, false); userCell.setCheckDisabled(chat == null || !chat.admins_enabled || part.user_id == UserConfig.getInstance(currentAccount).getClientUserId()); break; } }
Example 5
Source File: CacheControlActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == databaseRow) { textCell.setTextAndValue(LocaleController.getString("ClearLocalDatabase", R.string.ClearLocalDatabase), AndroidUtilities.formatFileSize(databaseSize), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == databaseInfoRow) { privacyCell.setText(LocaleController.getString("LocalDatabaseInfo", R.string.LocalDatabaseInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == cacheInfoRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == keepMediaInfoRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("KeepMediaInfo", R.string.KeepMediaInfo))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: StroageUsageView stroageUsageView = (StroageUsageView) holder.itemView; stroageUsageView.setStorageUsage(calculating, databaseSize, totalSize, totalDeviceFreeSize, totalDeviceSize); break; case 3: HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == keepMediaHeaderRow) { headerCell.setText(LocaleController.getString("KeepMedia", R.string.KeepMedia)); } else if (position == deviseStorageHeaderRow) { headerCell.setText(LocaleController.getString("DeviceStorage", R.string.DeviceStorage)); } break; } }
Example 6
Source File: GroupInviteActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == copyLinkRow) { textCell.setText(LocaleController.getString("CopyLink", R.string.CopyLink), true); } else if (position == shareLinkRow) { textCell.setText(LocaleController.getString("ShareLink", R.string.ShareLink), false); } else if (position == revokeLinkRow) { textCell.setText(LocaleController.getString("RevokeLink", R.string.RevokeLink), true); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == shadowRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == linkInfoRow) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id); if (ChatObject.isChannel(chat) && !chat.megagroup) { privacyCell.setText(LocaleController.getString("ChannelLinkInfo", R.string.ChannelLinkInfo)); } else { privacyCell.setText(LocaleController.getString("LinkInfo", R.string.LinkInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: TextBlockCell textBlockCell = (TextBlockCell) holder.itemView; textBlockCell.setText(invite != null ? invite.link : "error", false); break; } }
Example 7
Source File: TwoStepVerificationActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == changePasswordRow) { textCell.setText(LocaleController.getString("ChangePassword", R.string.ChangePassword), true); } else if (position == setPasswordRow) { textCell.setText(LocaleController.getString("SetAdditionalPassword", R.string.SetAdditionalPassword), true); } else if (position == turnPasswordOffRow) { textCell.setText(LocaleController.getString("TurnPasswordOff", R.string.TurnPasswordOff), true); } else if (position == changeRecoveryEmailRow) { textCell.setText(LocaleController.getString("ChangeRecoveryEmail", R.string.ChangeRecoveryEmail), false); } else if (position == setRecoveryEmailRow) { textCell.setText(LocaleController.getString("SetRecoveryEmail", R.string.SetRecoveryEmail), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == setPasswordDetailRow) { privacyCell.setText(LocaleController.getString("SetAdditionalPasswordInfo", R.string.SetAdditionalPasswordInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEnabledDetailRow) { privacyCell.setText(LocaleController.getString("EnabledPasswordText", R.string.EnabledPasswordText)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 8
Source File: SetAdminsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextCheckCell checkCell = (TextCheckCell) holder.itemView; chat = MessagesController.getInstance(currentAccount).getChat(chat_id); checkCell.setTextAndCheck(LocaleController.getString("SetAdminsAll", R.string.SetAdminsAll), chat != null && !chat.admins_enabled, false); break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == allAdminsInfoRow) { if (chat.admins_enabled) { privacyCell.setText(LocaleController.getString("SetAdminsNotAllInfo", R.string.SetAdminsNotAllInfo)); } else { privacyCell.setText(LocaleController.getString("SetAdminsAllInfo", R.string.SetAdminsAllInfo)); } if (usersStartRow != -1) { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } } else if (position == usersEndRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: UserCell userCell = (UserCell) holder.itemView; TLRPC.ChatParticipant part = participants.get(position - usersStartRow); TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(part.user_id); userCell.setData(user, null, null, 0); chat = MessagesController.getInstance(currentAccount).getChat(chat_id); userCell.setChecked(!(part instanceof TLRPC.TL_chatParticipant) || chat != null && !chat.admins_enabled, false); userCell.setCheckDisabled(chat == null || !chat.admins_enabled || part.user_id == UserConfig.getInstance(currentAccount).getClientUserId()); break; } }
Example 9
Source File: GroupInviteActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == copyLinkRow) { textCell.setText(LocaleController.getString("CopyLink", R.string.CopyLink), true); } else if (position == shareLinkRow) { textCell.setText(LocaleController.getString("ShareLink", R.string.ShareLink), false); } else if (position == revokeLinkRow) { textCell.setText(LocaleController.getString("RevokeLink", R.string.RevokeLink), true); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == shadowRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == linkInfoRow) { TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(chat_id); if (ChatObject.isChannel(chat) && !chat.megagroup) { privacyCell.setText(LocaleController.getString("ChannelLinkInfo", R.string.ChannelLinkInfo)); } else { privacyCell.setText(LocaleController.getString("LinkInfo", R.string.LinkInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; case 2: TextBlockCell textBlockCell = (TextBlockCell) holder.itemView; textBlockCell.setText(invite != null ? invite.link : "error", false); break; } }
Example 10
Source File: SessionsActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == terminateAllSessionsRow) { textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); textCell.setTag(Theme.key_windowBackgroundWhiteRedText2); if (currentType == 0) { textCell.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), false); } else { textCell.setText(LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), false); } } else if (position == qrCodeRow) { textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueText4)); textCell.setTag(Theme.key_windowBackgroundWhiteBlueText4); textCell.setText(LocaleController.getString("AuthAnotherClient", R.string.AuthAnotherClient), !sessions.isEmpty()); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == terminateAllSessionsDetailRow) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("ClearOtherSessionsHelp", R.string.ClearOtherSessionsHelp)); } else { privacyCell.setText(LocaleController.getString("ClearOtherWebSessionsHelp", R.string.ClearOtherWebSessionsHelp)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == otherSessionsTerminateDetail) { if (currentType == 0) { if (sessions.isEmpty()) { privacyCell.setText(""); } else { privacyCell.setText(LocaleController.getString("TerminateSessionInfo", R.string.TerminateSessionInfo)); } } else { privacyCell.setText(LocaleController.getString("TerminateWebSessionInfo", R.string.TerminateWebSessionInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordSessionsDetailRow) { privacyCell.setText(LocaleController.getString("LoginAttemptsInfo", R.string.LoginAttemptsInfo)); if (otherSessionsTerminateDetail == -1) { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } } break; case 2: HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == currentSessionSectionRow) { headerCell.setText(LocaleController.getString("CurrentSession", R.string.CurrentSession)); } else if (position == otherSessionsSectionRow) { if (currentType == 0) { headerCell.setText(LocaleController.getString("OtherSessions", R.string.OtherSessions)); } else { headerCell.setText(LocaleController.getString("OtherWebSessions", R.string.OtherWebSessions)); } } else if (position == passwordSessionsSectionRow) { headerCell.setText(LocaleController.getString("LoginAttempts", R.string.LoginAttempts)); } break; case 3: ViewGroup.LayoutParams layoutParams = emptyLayout.getLayoutParams(); if (layoutParams != null) { layoutParams.height = Math.max(AndroidUtilities.dp(220), AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(128 + (qrCodeRow == -1 ? 0 : 30)) - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)); emptyLayout.setLayoutParams(layoutParams); } break; default: SessionCell sessionCell = (SessionCell) holder.itemView; if (position == currentSessionRow) { sessionCell.setSession(currentSession, !sessions.isEmpty() || !passwordSessions.isEmpty() || qrCodeRow != -1); } else if (position >= otherSessionsStartRow && position < otherSessionsEndRow) { sessionCell.setSession(sessions.get(position - otherSessionsStartRow), position != otherSessionsEndRow - 1); } else if (position >= passwordSessionsStartRow && position < passwordSessionsEndRow) { sessionCell.setSession(passwordSessions.get(position - passwordSessionsStartRow), position != passwordSessionsEndRow - 1); } break; } }
Example 11
Source File: DataUsageActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: { if (position == resetSection2Row) { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } case 1: { TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == resetRow) { textCell.setTag(Theme.key_windowBackgroundWhiteRedText2); textCell.setText(LocaleController.getString("ResetStatistics", R.string.ResetStatistics), false); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); } else { int type; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == callsSentRow || position == callsReceivedRow || position == callsBytesSentRow || position == callsBytesReceivedRow) { type = StatsController.TYPE_CALLS; } else if (position == messagesSentRow || position == messagesReceivedRow || position == messagesBytesSentRow || position == messagesBytesReceivedRow) { type = StatsController.TYPE_MESSAGES; } else if (position == photosSentRow || position == photosReceivedRow || position == photosBytesSentRow || position == photosBytesReceivedRow) { type = StatsController.TYPE_PHOTOS; } else if (position == audiosSentRow || position == audiosReceivedRow || position == audiosBytesSentRow || position == audiosBytesReceivedRow) { type = StatsController.TYPE_AUDIOS; } else if (position == videosSentRow || position == videosReceivedRow || position == videosBytesSentRow || position == videosBytesReceivedRow) { type = StatsController.TYPE_VIDEOS; } else if (position == filesSentRow || position == filesReceivedRow || position == filesBytesSentRow || position == filesBytesReceivedRow) { type = StatsController.TYPE_FILES; } else { type = StatsController.TYPE_TOTAL; } if (position == callsSentRow) { textCell.setTextAndValue(LocaleController.getString("OutgoingCalls", R.string.OutgoingCalls), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == callsReceivedRow) { textCell.setTextAndValue(LocaleController.getString("IncomingCalls", R.string.IncomingCalls), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == callsTotalTimeRow) { String time = AndroidUtilities.formatShortDuration(StatsController.getInstance(currentAccount).getCallsTotalTime(currentType)); textCell.setTextAndValue(LocaleController.getString("CallsTotalTime", R.string.CallsTotalTime), time, false); } else if (position == messagesSentRow || position == photosSentRow || position == videosSentRow || position == audiosSentRow || position == filesSentRow) { textCell.setTextAndValue(LocaleController.getString("CountSent", R.string.CountSent), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == messagesReceivedRow || position == photosReceivedRow || position == videosReceivedRow || position == audiosReceivedRow || position == filesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("CountReceived", R.string.CountReceived), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == messagesBytesSentRow || position == photosBytesSentRow || position == videosBytesSentRow || position == audiosBytesSentRow || position == filesBytesSentRow || position == callsBytesSentRow || position == totalBytesSentRow) { textCell.setTextAndValue(LocaleController.getString("BytesSent", R.string.BytesSent), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getSentBytesCount(currentType, type)), true); } else if (position == messagesBytesReceivedRow || position == photosBytesReceivedRow || position == videosBytesReceivedRow || position == audiosBytesReceivedRow || position == filesBytesReceivedRow || position == callsBytesReceivedRow || position == totalBytesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("BytesReceived", R.string.BytesReceived), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getReceivedBytesCount(currentType, type)), position == callsBytesReceivedRow); } } break; } case 2: { HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == totalSectionRow) { headerCell.setText(LocaleController.getString("TotalDataUsage", R.string.TotalDataUsage)); } else if (position == callsSectionRow) { headerCell.setText(LocaleController.getString("CallsDataUsage", R.string.CallsDataUsage)); } else if (position == filesSectionRow) { headerCell.setText(LocaleController.getString("FilesDataUsage", R.string.FilesDataUsage)); } else if (position == audiosSectionRow) { headerCell.setText(LocaleController.getString("LocalAudioCache", R.string.LocalAudioCache)); } else if (position == videosSectionRow) { headerCell.setText(LocaleController.getString("LocalVideoCache", R.string.LocalVideoCache)); } else if (position == photosSectionRow) { headerCell.setText(LocaleController.getString("LocalPhotoCache", R.string.LocalPhotoCache)); } else if (position == messagesSectionRow) { headerCell.setText(LocaleController.getString("MessagesDataUsage", R.string.MessagesDataUsage)); } break; } case 3: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setText(LocaleController.formatString("NetworkUsageSince", R.string.NetworkUsageSince, LocaleController.getInstance().formatterStats.format(StatsController.getInstance(currentAccount).getResetStatsDate(currentType)))); break; } default: break; } }
Example 12
Source File: PrivacyUsersActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: ManageChatUserCell userCell = (ManageChatUserCell) holder.itemView; int uid; if (currentType == TYPE_BLOCKED) { uid = getMessagesController().blockedUsers.keyAt(position - usersStartRow); } else { uid = uidArray.get(position - usersStartRow); } userCell.setTag(uid); if (uid > 0) { TLRPC.User user = getMessagesController().getUser(uid); if (user != null) { String number; if (user.bot) { number = LocaleController.getString("Bot", R.string.Bot).substring(0, 1).toUpperCase() + LocaleController.getString("Bot", R.string.Bot).substring(1); } else if (user.phone != null && user.phone.length() != 0) { number = PhoneFormat.getInstance().format("+" + user.phone); } else { number = LocaleController.getString("NumberUnknown", R.string.NumberUnknown); } userCell.setData(user, null, number, position != usersEndRow - 1); } } else { TLRPC.Chat chat = getMessagesController().getChat(-uid); if (chat != null) { String subtitle; if (chat.participants_count != 0) { subtitle = LocaleController.formatPluralString("Members", chat.participants_count); } else if (chat.has_geo) { subtitle = LocaleController.getString("MegaLocation", R.string.MegaLocation); } else if (TextUtils.isEmpty(chat.username)) { subtitle = LocaleController.getString("MegaPrivate", R.string.MegaPrivate); } else { subtitle = LocaleController.getString("MegaPublic", R.string.MegaPublic); } userCell.setData(chat, null, subtitle, position != usersEndRow - 1); } } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == blockUserDetailRow) { if (currentType == TYPE_BLOCKED) { privacyCell.setText(LocaleController.getString("BlockedUsersInfo", R.string.BlockedUsersInfo)); } else { privacyCell.setText(null); } if (usersStartRow == -1) { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } } else if (position == usersDetailRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: ManageChatTextCell actionCell = (ManageChatTextCell) holder.itemView; actionCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton); if (currentType == TYPE_BLOCKED) { actionCell.setText(LocaleController.getString("BlockUser", R.string.BlockUser), null, R.drawable.actions_addmember2, false); } else { actionCell.setText(LocaleController.getString("PrivacyAddAnException", R.string.PrivacyAddAnException), null, R.drawable.actions_addmember2, false); } break; case 3: HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == usersHeaderRow) { if (currentType == TYPE_BLOCKED) { headerCell.setText(LocaleController.formatPluralString("BlockedUsersCount", getMessagesController().totalBlockedCount)); } else { headerCell.setText(LocaleController.getString("PrivacyExceptions", R.string.PrivacyExceptions)); } } break; } }
Example 13
Source File: SessionsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == terminateAllSessionsRow) { textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); if (currentType == 0) { textCell.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), false); } else { textCell.setText(LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), false); } } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == terminateAllSessionsDetailRow) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("ClearOtherSessionsHelp", R.string.ClearOtherSessionsHelp)); } else { privacyCell.setText(LocaleController.getString("ClearOtherWebSessionsHelp", R.string.ClearOtherWebSessionsHelp)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == otherSessionsTerminateDetail) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("TerminateSessionInfo", R.string.TerminateSessionInfo)); } else { privacyCell.setText(LocaleController.getString("TerminateWebSessionInfo", R.string.TerminateWebSessionInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == currentSessionSectionRow) { headerCell.setText(LocaleController.getString("CurrentSession", R.string.CurrentSession)); } else if (position == otherSessionsSectionRow) { if (currentType == 0) { headerCell.setText(LocaleController.getString("OtherSessions", R.string.OtherSessions)); } else { headerCell.setText(LocaleController.getString("OtherWebSessions", R.string.OtherWebSessions)); } } break; case 3: ViewGroup.LayoutParams layoutParams = emptyLayout.getLayoutParams(); if (layoutParams != null) { layoutParams.height = Math.max(AndroidUtilities.dp(220), AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(128) - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)); emptyLayout.setLayoutParams(layoutParams); } break; default: SessionCell sessionCell = (SessionCell) holder.itemView; if (position == currentSessionRow) { sessionCell.setSession(currentSession, !sessions.isEmpty()); } else { sessionCell.setSession(sessions.get(position - otherSessionsStartRow), position != otherSessionsEndRow - 1); } break; } }
Example 14
Source File: DataUsageActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: { if (position == resetSection2Row) { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } case 1: { TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == resetRow) { textCell.setTag(Theme.key_windowBackgroundWhiteRedText2); textCell.setText(LocaleController.getString("ResetStatistics", R.string.ResetStatistics), false); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); } else { int type; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == callsSentRow || position == callsReceivedRow || position == callsBytesSentRow || position == callsBytesReceivedRow) { type = StatsController.TYPE_CALLS; } else if (position == messagesSentRow || position == messagesReceivedRow || position == messagesBytesSentRow || position == messagesBytesReceivedRow) { type = StatsController.TYPE_MESSAGES; } else if (position == photosSentRow || position == photosReceivedRow || position == photosBytesSentRow || position == photosBytesReceivedRow) { type = StatsController.TYPE_PHOTOS; } else if (position == audiosSentRow || position == audiosReceivedRow || position == audiosBytesSentRow || position == audiosBytesReceivedRow) { type = StatsController.TYPE_AUDIOS; } else if (position == videosSentRow || position == videosReceivedRow || position == videosBytesSentRow || position == videosBytesReceivedRow) { type = StatsController.TYPE_VIDEOS; } else if (position == filesSentRow || position == filesReceivedRow || position == filesBytesSentRow || position == filesBytesReceivedRow) { type = StatsController.TYPE_FILES; } else { type = StatsController.TYPE_TOTAL; } if (position == callsSentRow) { textCell.setTextAndValue(LocaleController.getString("OutgoingCalls", R.string.OutgoingCalls), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == callsReceivedRow) { textCell.setTextAndValue(LocaleController.getString("IncomingCalls", R.string.IncomingCalls), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == callsTotalTimeRow) { int total = StatsController.getInstance(currentAccount).getCallsTotalTime(currentType); int hours = total / 3600; total -= hours * 3600; int minutes = total / 60; total -= minutes * 60; String time; if (hours != 0) { time = String.format("%d:%02d:%02d", hours, minutes, total); } else { time = String.format("%d:%02d", minutes, total); } textCell.setTextAndValue(LocaleController.getString("CallsTotalTime", R.string.CallsTotalTime), time, false); } else if (position == messagesSentRow || position == photosSentRow || position == videosSentRow || position == audiosSentRow || position == filesSentRow) { textCell.setTextAndValue(LocaleController.getString("CountSent", R.string.CountSent), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == messagesReceivedRow || position == photosReceivedRow || position == videosReceivedRow || position == audiosReceivedRow || position == filesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("CountReceived", R.string.CountReceived), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == messagesBytesSentRow || position == photosBytesSentRow || position == videosBytesSentRow || position == audiosBytesSentRow || position == filesBytesSentRow || position == callsBytesSentRow || position == totalBytesSentRow) { textCell.setTextAndValue(LocaleController.getString("BytesSent", R.string.BytesSent), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getSentBytesCount(currentType, type)), true); } else if (position == messagesBytesReceivedRow || position == photosBytesReceivedRow || position == videosBytesReceivedRow || position == audiosBytesReceivedRow || position == filesBytesReceivedRow || position == callsBytesReceivedRow || position == totalBytesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("BytesReceived", R.string.BytesReceived), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getReceivedBytesCount(currentType, type)), position != totalBytesReceivedRow); } } break; } case 2: { HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == totalSectionRow) { headerCell.setText(LocaleController.getString("TotalDataUsage", R.string.TotalDataUsage)); } else if (position == callsSectionRow) { headerCell.setText(LocaleController.getString("CallsDataUsage", R.string.CallsDataUsage)); } else if (position == filesSectionRow) { headerCell.setText(LocaleController.getString("FilesDataUsage", R.string.FilesDataUsage)); } else if (position == audiosSectionRow) { headerCell.setText(LocaleController.getString("LocalAudioCache", R.string.LocalAudioCache)); } else if (position == videosSectionRow) { headerCell.setText(LocaleController.getString("LocalVideoCache", R.string.LocalVideoCache)); } else if (position == photosSectionRow) { headerCell.setText(LocaleController.getString("LocalPhotoCache", R.string.LocalPhotoCache)); } else if (position == messagesSectionRow) { headerCell.setText(LocaleController.getString("MessagesDataUsage", R.string.MessagesDataUsage)); } break; } case 3: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setText(LocaleController.formatString("NetworkUsageSince", R.string.NetworkUsageSince, LocaleController.getInstance().formatterStats.format(StatsController.getInstance(currentAccount).getResetStatsDate(currentType)))); break; } default: break; } }
Example 15
Source File: CacheControlActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == databaseRow) { textCell.setTextAndValue(LocaleController.getString("LocalDatabase", R.string.LocalDatabase), AndroidUtilities.formatFileSize(databaseSize), false); } else if (position == cacheRow) { if (calculating) { textCell.setTextAndValue(LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), LocaleController.getString("CalculatingSize", R.string.CalculatingSize), false); } else { textCell.setTextAndValue(LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), totalSize == 0 ? LocaleController.getString("CacheEmpty", R.string.CacheEmpty) : AndroidUtilities.formatFileSize(totalSize), false); } } else if (position == keepMediaRow) { SharedPreferences preferences = MessagesController.getGlobalMainSettings(); int keepMedia = preferences.getInt("keep_media", 2); String value; if (keepMedia == 0) { value = LocaleController.formatPluralString("Weeks", 1); } else if (keepMedia == 1) { value = LocaleController.formatPluralString("Months", 1); } else if (keepMedia == 3) { value = LocaleController.formatPluralString("Days", 3); } else { value = LocaleController.getString("KeepMediaForever", R.string.KeepMediaForever); } textCell.setTextAndValue(LocaleController.getString("KeepMedia", R.string.KeepMedia), value, false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == databaseInfoRow) { privacyCell.setText(LocaleController.getString("LocalDatabaseInfo", R.string.LocalDatabaseInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == cacheInfoRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == keepMediaInfoRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("KeepMediaInfo", R.string.KeepMediaInfo))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 16
Source File: TwoStepVerificationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == changePasswordRow) { textCell.setText(LocaleController.getString("ChangePassword", R.string.ChangePassword), true); } else if (position == setPasswordRow) { textCell.setText(LocaleController.getString("SetAdditionalPassword", R.string.SetAdditionalPassword), true); } else if (position == turnPasswordOffRow) { textCell.setText(LocaleController.getString("TurnPasswordOff", R.string.TurnPasswordOff), true); } else if (position == changeRecoveryEmailRow) { textCell.setText(LocaleController.getString("ChangeRecoveryEmail", R.string.ChangeRecoveryEmail), abortPasswordRow != -1); } else if (position == setRecoveryEmailRow) { textCell.setText(LocaleController.getString("SetRecoveryEmail", R.string.SetRecoveryEmail), false); } else if (position == abortPasswordRow) { textCell.setTag(Theme.key_windowBackgroundWhiteRedText3); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)); textCell.setText(LocaleController.getString("AbortPassword", R.string.AbortPassword), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == setPasswordDetailRow) { privacyCell.setText(LocaleController.getString("SetAdditionalPasswordInfo", R.string.SetAdditionalPasswordInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == shadowRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordSetupDetailRow) { privacyCell.setText(LocaleController.formatString("EmailPasswordConfirmText", R.string.EmailPasswordConfirmText, currentPassword.email_unconfirmed_pattern != null ? currentPassword.email_unconfirmed_pattern : "")); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEnabledDetailRow) { privacyCell.setText(LocaleController.getString("EnabledPasswordText", R.string.EnabledPasswordText)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEmailVerifyDetailRow) { privacyCell.setText(LocaleController.formatString("PendingEmailText", R.string.PendingEmailText, currentPassword.email_unconfirmed_pattern != null ? currentPassword.email_unconfirmed_pattern : "")); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 17
Source File: SessionsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == terminateAllSessionsRow) { textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); if (currentType == 0) { textCell.setText(LocaleController.getString("TerminateAllSessions", R.string.TerminateAllSessions), false); } else { textCell.setText(LocaleController.getString("TerminateAllWebSessions", R.string.TerminateAllWebSessions), false); } } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == terminateAllSessionsDetailRow) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("ClearOtherSessionsHelp", R.string.ClearOtherSessionsHelp)); } else { privacyCell.setText(LocaleController.getString("ClearOtherWebSessionsHelp", R.string.ClearOtherWebSessionsHelp)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == otherSessionsTerminateDetail) { if (currentType == 0) { privacyCell.setText(LocaleController.getString("TerminateSessionInfo", R.string.TerminateSessionInfo)); } else { privacyCell.setText(LocaleController.getString("TerminateWebSessionInfo", R.string.TerminateWebSessionInfo)); } privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; case 2: HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == currentSessionSectionRow) { headerCell.setText(LocaleController.getString("CurrentSession", R.string.CurrentSession)); } else if (position == otherSessionsSectionRow) { if (currentType == 0) { headerCell.setText(LocaleController.getString("OtherSessions", R.string.OtherSessions)); } else { headerCell.setText(LocaleController.getString("OtherWebSessions", R.string.OtherWebSessions)); } } break; case 3: ViewGroup.LayoutParams layoutParams = emptyLayout.getLayoutParams(); if (layoutParams != null) { layoutParams.height = Math.max(AndroidUtilities.dp(220), AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(128) - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0)); emptyLayout.setLayoutParams(layoutParams); } break; default: SessionCell sessionCell = (SessionCell) holder.itemView; if (position == currentSessionRow) { sessionCell.setSession(currentSession, !sessions.isEmpty()); } else { sessionCell.setSession(sessions.get(position - otherSessionsStartRow), position != otherSessionsEndRow - 1); } break; } }
Example 18
Source File: DataUsageActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: { if (position == resetSection2Row) { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else { holder.itemView.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } case 1: { TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == resetRow) { textCell.setTag(Theme.key_windowBackgroundWhiteRedText2); textCell.setText(LocaleController.getString("ResetStatistics", R.string.ResetStatistics), false); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText2)); } else { int type; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == callsSentRow || position == callsReceivedRow || position == callsBytesSentRow || position == callsBytesReceivedRow) { type = StatsController.TYPE_CALLS; } else if (position == messagesSentRow || position == messagesReceivedRow || position == messagesBytesSentRow || position == messagesBytesReceivedRow) { type = StatsController.TYPE_MESSAGES; } else if (position == photosSentRow || position == photosReceivedRow || position == photosBytesSentRow || position == photosBytesReceivedRow) { type = StatsController.TYPE_PHOTOS; } else if (position == audiosSentRow || position == audiosReceivedRow || position == audiosBytesSentRow || position == audiosBytesReceivedRow) { type = StatsController.TYPE_AUDIOS; } else if (position == videosSentRow || position == videosReceivedRow || position == videosBytesSentRow || position == videosBytesReceivedRow) { type = StatsController.TYPE_VIDEOS; } else if (position == filesSentRow || position == filesReceivedRow || position == filesBytesSentRow || position == filesBytesReceivedRow) { type = StatsController.TYPE_FILES; } else { type = StatsController.TYPE_TOTAL; } if (position == callsSentRow) { textCell.setTextAndValue(LocaleController.getString("OutgoingCalls", R.string.OutgoingCalls), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == callsReceivedRow) { textCell.setTextAndValue(LocaleController.getString("IncomingCalls", R.string.IncomingCalls), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == callsTotalTimeRow) { int total = StatsController.getInstance(currentAccount).getCallsTotalTime(currentType); int hours = total / 3600; total -= hours * 3600; int minutes = total / 60; total -= minutes * 60; String time; if (hours != 0) { time = String.format("%d:%02d:%02d", hours, minutes, total); } else { time = String.format("%d:%02d", minutes, total); } textCell.setTextAndValue(LocaleController.getString("CallsTotalTime", R.string.CallsTotalTime), time, false); } else if (position == messagesSentRow || position == photosSentRow || position == videosSentRow || position == audiosSentRow || position == filesSentRow) { textCell.setTextAndValue(LocaleController.getString("CountSent", R.string.CountSent), String.format("%d", StatsController.getInstance(currentAccount).getSentItemsCount(currentType, type)), true); } else if (position == messagesReceivedRow || position == photosReceivedRow || position == videosReceivedRow || position == audiosReceivedRow || position == filesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("CountReceived", R.string.CountReceived), String.format("%d", StatsController.getInstance(currentAccount).getRecivedItemsCount(currentType, type)), true); } else if (position == messagesBytesSentRow || position == photosBytesSentRow || position == videosBytesSentRow || position == audiosBytesSentRow || position == filesBytesSentRow || position == callsBytesSentRow || position == totalBytesSentRow) { textCell.setTextAndValue(LocaleController.getString("BytesSent", R.string.BytesSent), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getSentBytesCount(currentType, type)), true); } else if (position == messagesBytesReceivedRow || position == photosBytesReceivedRow || position == videosBytesReceivedRow || position == audiosBytesReceivedRow || position == filesBytesReceivedRow || position == callsBytesReceivedRow || position == totalBytesReceivedRow) { textCell.setTextAndValue(LocaleController.getString("BytesReceived", R.string.BytesReceived), AndroidUtilities.formatFileSize(StatsController.getInstance(currentAccount).getReceivedBytesCount(currentType, type)), position != totalBytesReceivedRow); } } break; } case 2: { HeaderCell headerCell = (HeaderCell) holder.itemView; if (position == totalSectionRow) { headerCell.setText(LocaleController.getString("TotalDataUsage", R.string.TotalDataUsage)); } else if (position == callsSectionRow) { headerCell.setText(LocaleController.getString("CallsDataUsage", R.string.CallsDataUsage)); } else if (position == filesSectionRow) { headerCell.setText(LocaleController.getString("FilesDataUsage", R.string.FilesDataUsage)); } else if (position == audiosSectionRow) { headerCell.setText(LocaleController.getString("LocalAudioCache", R.string.LocalAudioCache)); } else if (position == videosSectionRow) { headerCell.setText(LocaleController.getString("LocalVideoCache", R.string.LocalVideoCache)); } else if (position == photosSectionRow) { headerCell.setText(LocaleController.getString("LocalPhotoCache", R.string.LocalPhotoCache)); } else if (position == messagesSectionRow) { headerCell.setText(LocaleController.getString("MessagesDataUsage", R.string.MessagesDataUsage)); } break; } case 3: { TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView; cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); cell.setText(LocaleController.formatString("NetworkUsageSince", R.string.NetworkUsageSince, LocaleController.getInstance().formatterStats.format(StatsController.getInstance(currentAccount).getResetStatsDate(currentType)))); break; } default: break; } }
Example 19
Source File: CacheControlActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; if (position == databaseRow) { textCell.setTextAndValue(LocaleController.getString("LocalDatabase", R.string.LocalDatabase), AndroidUtilities.formatFileSize(databaseSize), false); } else if (position == cacheRow) { if (calculating) { textCell.setTextAndValue(LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), LocaleController.getString("CalculatingSize", R.string.CalculatingSize), false); } else { textCell.setTextAndValue(LocaleController.getString("ClearMediaCache", R.string.ClearMediaCache), totalSize == 0 ? LocaleController.getString("CacheEmpty", R.string.CacheEmpty) : AndroidUtilities.formatFileSize(totalSize), false); } } else if (position == keepMediaRow) { SharedPreferences preferences = MessagesController.getGlobalMainSettings(); int keepMedia = preferences.getInt("keep_media", 2); String value; if (keepMedia == 0) { value = LocaleController.formatPluralString("Weeks", 1); } else if (keepMedia == 1) { value = LocaleController.formatPluralString("Months", 1); } else if (keepMedia == 3) { value = LocaleController.formatPluralString("Days", 3); } else { value = LocaleController.getString("KeepMediaForever", R.string.KeepMediaForever); } textCell.setTextAndValue(LocaleController.getString("KeepMedia", R.string.KeepMedia), value, false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == databaseInfoRow) { privacyCell.setText(LocaleController.getString("LocalDatabaseInfo", R.string.LocalDatabaseInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == cacheInfoRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } else if (position == keepMediaInfoRow) { privacyCell.setText(AndroidUtilities.replaceTags(LocaleController.getString("KeepMediaInfo", R.string.KeepMediaInfo))); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow)); } break; } }
Example 20
Source File: TwoStepVerificationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { switch (holder.getItemViewType()) { case 0: TextSettingsCell textCell = (TextSettingsCell) holder.itemView; textCell.setTag(Theme.key_windowBackgroundWhiteBlackText); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); if (position == changePasswordRow) { textCell.setText(LocaleController.getString("ChangePassword", R.string.ChangePassword), true); } else if (position == setPasswordRow) { textCell.setText(LocaleController.getString("SetAdditionalPassword", R.string.SetAdditionalPassword), true); } else if (position == turnPasswordOffRow) { textCell.setText(LocaleController.getString("TurnPasswordOff", R.string.TurnPasswordOff), true); } else if (position == changeRecoveryEmailRow) { textCell.setText(LocaleController.getString("ChangeRecoveryEmail", R.string.ChangeRecoveryEmail), abortPasswordRow != -1); } else if (position == setRecoveryEmailRow) { textCell.setText(LocaleController.getString("SetRecoveryEmail", R.string.SetRecoveryEmail), false); } else if (position == abortPasswordRow) { textCell.setTag(Theme.key_windowBackgroundWhiteRedText3); textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText3)); textCell.setText(LocaleController.getString("AbortPassword", R.string.AbortPassword), false); } break; case 1: TextInfoPrivacyCell privacyCell = (TextInfoPrivacyCell) holder.itemView; if (position == setPasswordDetailRow) { privacyCell.setText(LocaleController.getString("SetAdditionalPasswordInfo", R.string.SetAdditionalPasswordInfo)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == shadowRow) { privacyCell.setText(""); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordSetupDetailRow) { privacyCell.setText(LocaleController.formatString("EmailPasswordConfirmText", R.string.EmailPasswordConfirmText, currentPassword.email_unconfirmed_pattern != null ? currentPassword.email_unconfirmed_pattern : "")); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_top, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEnabledDetailRow) { privacyCell.setText(LocaleController.getString("EnabledPasswordText", R.string.EnabledPasswordText)); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } else if (position == passwordEmailVerifyDetailRow) { privacyCell.setText(LocaleController.formatString("PendingEmailText", R.string.PendingEmailText, currentPassword.email_unconfirmed_pattern != null ? currentPassword.email_unconfirmed_pattern : "")); privacyCell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow)); } break; } }