Java Code Examples for org.telegram.ui.Cells.SharedDocumentCell#setTextAndValueAndTypeAndThumb()

The following examples show how to use org.telegram.ui.Cells.SharedDocumentCell#setTextAndValueAndTypeAndThumb() . 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: DocumentSelectActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 1) {
        ListItem item = getItem(position);
        SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;
        if (item.icon != 0) {
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon);
        } else {
            String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0);
        }
        if (item.file != null && actionBar.isActionModeShowed()) {
            documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
        } else {
            documentCell.setChecked(false, !scrolling);
        }
    }
}
 
Example 2
Source File: DocumentSelectActivity.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 1) {
        ListItem item = getItem(position);
        SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;
        if (item.icon != 0) {
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon);
        } else {
            String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0);
        }
        if (item.file != null && actionBar.isActionModeShowed()) {
            documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
        } else {
            documentCell.setChecked(false, !scrolling);
        }
    }
}
 
Example 3
Source File: ChatAttachAlertDocumentLayout.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 0) {
        ListItem item = getItem(position);
        SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;

        if (item.icon != 0) {
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon, false);
        } else {
            String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0, false);
        }
        if (item.file != null) {
            documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
        } else {
            documentCell.setChecked(false, !scrolling);
        }
    }
}
 
Example 4
Source File: ChatAttachAlertDocumentLayout.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() == 0) {
        ListItem item = getItem(position);
        SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;

        if (item.icon != 0) {
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon, false);
        } else {
            String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
            documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0, false);
        }
        if (item.file != null) {
            documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
        } else {
            documentCell.setChecked(false, !scrolling);
        }
    }
}
 
Example 5
Source File: ChatAttachAlertDocumentLayout.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0:
            HeaderCell headerCell = (HeaderCell) holder.itemView;
            if (sortByName) {
                headerCell.setText(LocaleController.getString("RecentFilesAZ", R.string.RecentFilesAZ));
            } else {
                headerCell.setText(LocaleController.getString("RecentFiles", R.string.RecentFiles));
            }
            break;
        case 1:
            ListItem item = getItem(position);
            SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;
            if (item.icon != 0) {
                documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon, position != items.size() - 1);
            } else {
                String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
                documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0, false);
            }
            if (item.file != null) {
                documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
            } else {
                documentCell.setChecked(false, !scrolling);
            }
            break;
    }
}
 
Example 6
Source File: ChatAttachAlertDocumentLayout.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0:
            HeaderCell headerCell = (HeaderCell) holder.itemView;
            if (sortByName) {
                headerCell.setText(LocaleController.getString("RecentFilesAZ", R.string.RecentFilesAZ));
            } else {
                headerCell.setText(LocaleController.getString("RecentFiles", R.string.RecentFiles));
            }
            break;
        case 1:
            ListItem item = getItem(position);
            SharedDocumentCell documentCell = (SharedDocumentCell) holder.itemView;
            if (item.icon != 0) {
                documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, null, null, item.icon, position != items.size() - 1);
            } else {
                String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
                documentCell.setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0, false);
            }
            if (item.file != null) {
                documentCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
            } else {
                documentCell.setChecked(false, !scrolling);
            }
            break;
    }
}