Permalink
Browse files

List items layout inflation fix

  • Loading branch information...
poretsky committed Nov 2, 2017
1 parent 7e15949 commit d2f629445ea6281aad6d394af1b2bd7de831e564
@@ -318,7 +318,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
switch (getItemViewType(position)) {
case REMOTE_FILE_VIEW_TYPE: {
if((convertView == null) || (convertView.findViewById(R.id.fileinfo) == null))
convertView = inflater.inflate(R.layout.item_remote_file, null);
convertView = inflater.inflate(R.layout.item_remote_file, parent, false);
((TextView)convertView.findViewById(R.id.fileinfo)).setText(String.format("%d (%s)", remoteFile.nFileSize, remoteFile.szUsername));
Button downloadButton = (Button)convertView.findViewById(R.id.download_btn);
Button removeButton = (Button)convertView.findViewById(R.id.remove_btn);
@@ -330,7 +330,7 @@ public void onClick(DialogInterface dialog, int whichButton) {
}
case FILE_TRANSFER_VIEW_TYPE: {
if((convertView == null) || (convertView.findViewById(R.id.progress) == null))
convertView = inflater.inflate(R.layout.item_file_transfer, null);
convertView = inflater.inflate(R.layout.item_file_transfer, parent, false);
FileTransfer transferinfo = downloads.get(remoteFile.szFileName);
((TextView)convertView.findViewById(R.id.progress)).setText(context.getString(R.string.download_progress, getPercentage(transferinfo)));
Button cancelButton = (Button)convertView.findViewById(R.id.cancel_btn);
@@ -138,7 +138,7 @@ public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
int userid = (int) getGroupId(groupPosition);
if (convertView == null)
convertView = inflater.inflate(R.layout.item_media, null);
convertView = inflater.inflate(R.layout.item_media, parent, false);
Bitmap bmp = media_sessions.get(userid);
if (bmp != null) {
@@ -176,7 +176,7 @@ public View getGroupView(int groupPosition, boolean isExpanded,
int userid = (int) getGroupId(groupPosition);
if (convertView == null)
convertView = inflater.inflate(R.layout.item_media_user, null);
convertView = inflater.inflate(R.layout.item_media_user, parent, false);
TextView nickname = (TextView) convertView
.findViewById(R.id.media_nickname_textview);
@@ -145,7 +145,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
case TextMsgType.MSGTYPE_USER : {
if(convertView == null ||
convertView.findViewById(R.id.item_textmsg) == null)
convertView = inflater.inflate(R.layout.item_textmsg, null);
convertView = inflater.inflate(R.layout.item_textmsg, parent, false);
if(txtmsg.nFromUserID == myuserid) {
bg_color = self_bg_color;
@@ -172,7 +172,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
case MyTextMessage.MSGTYPE_SERVERPROP : {
if(convertView == null ||
convertView.findViewById(R.id.item_textmsg_srvinfo) == null) {
convertView = inflater.inflate(R.layout.item_textmsg_srvinfo, null);
convertView = inflater.inflate(R.layout.item_textmsg_srvinfo, parent, false);
}
bg_color = srvinfo_bg_color;
@@ -196,7 +196,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
default : {
if(convertView == null ||
convertView.findViewById(R.id.item_textmsg_logmsg) == null) {
convertView = inflater.inflate(R.layout.item_textmsg_logmsg, null);
convertView = inflater.inflate(R.layout.item_textmsg_logmsg, parent, false);
}
switch(txtmsg.nMsgType) {
@@ -77,7 +77,7 @@ protected void onStart() {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if(convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_file, null);
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_file, parent, false);
File item = getItem(position);
TextView filename = (TextView) convertView.findViewById(R.id.filename);
ImageView icon = (ImageView) convertView.findViewById(R.id.icon);
@@ -925,13 +925,13 @@ public View getView(int position, View convertView, ViewGroup parent) {
// show parent channel shortcut
if (convertView == null ||
convertView.findViewById(R.id.parentname) == null)
convertView = inflater.inflate(R.layout.item_channel_back, null);
convertView = inflater.inflate(R.layout.item_channel_back, parent, false);
}
else {
if (convertView == null ||
convertView.findViewById(R.id.channelname) == null)
convertView = inflater.inflate(R.layout.item_channel, null);
convertView = inflater.inflate(R.layout.item_channel, parent, false);
ImageView chanicon = (ImageView) convertView.findViewById(R.id.channelicon);
TextView name = (TextView) convertView.findViewById(R.id.channelname);
@@ -981,7 +981,7 @@ public void onClick(View v) {
else if(item instanceof User) {
if (convertView == null ||
convertView.findViewById(R.id.nickname) == null)
convertView = inflater.inflate(R.layout.item_user, null);
convertView = inflater.inflate(R.layout.item_user, parent, false);
ImageView usericon = (ImageView) convertView.findViewById(R.id.usericon);
TextView nickname = (TextView) convertView.findViewById(R.id.nickname);
TextView status = (TextView) convertView.findViewById(R.id.status);
@@ -334,7 +334,7 @@ public long getItemId(int position) {
public View getView(final int position, View convertView, ViewGroup parent) {
if(convertView == null)
convertView = inflater.inflate(R.layout.item_serverentry, null);
convertView = inflater.inflate(R.layout.item_serverentry, parent, false);
ImageView img = (ImageView) convertView.findViewById(R.id.servericon);
TextView name = (TextView) convertView.findViewById(R.id.server_name);

0 comments on commit d2f6294

Please sign in to comment.