Skip to content
This repository has been archived by the owner on Jun 4, 2018. It is now read-only.

Commit

Permalink
Fix ui freeze when changing output profile by reusing view
Browse files Browse the repository at this point in the history
  • Loading branch information
djselbeck committed Oct 17, 2017
1 parent c7768da commit e65c953
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ public View getView(int position, View convertView, ViewGroup parent) {
int outputId = output.getID();
boolean active = output.getOutputState();


convertView = new OutputListItem(mContext, outputName, active, outputId);
if ( convertView == null ) {
// Create a new View and not reuse it
convertView = new OutputListItem(mContext, outputName, active, outputId);
} else {
OutputListItem outputItem = (OutputListItem)convertView;
outputItem.setName(outputName);
outputItem.setChecked(active);
}

return convertView;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,12 @@ public OutputListItem(Context context, String outputName, boolean active, int ou
mMainView.setChecked(active);
}

public void setName(String name) {
mMainView.setText(name);
}

public void setChecked(boolean checked) {
mMainView.setChecked(checked);
}

}

0 comments on commit e65c953

Please sign in to comment.