Fix repo_item layout parameters resolution

See http://www.doubleencore.com/2013/05/layout-inflation-as-intended
This commit is contained in:
relan 2015-09-22 16:26:49 +03:00
parent c18900c242
commit d3f7e9555e

View File

@ -53,7 +53,7 @@ public class RepoAdapter extends CursorAdapter {
@Override @Override
public View newView(Context context, Cursor cursor, ViewGroup parent) { public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = inflater.inflate(R.layout.repo_item, null); View view = inflater.inflate(R.layout.repo_item, parent, false);
CompoundButton switchView = addSwitchToView(view, context); CompoundButton switchView = addSwitchToView(view, context);
setupView(cursor, view, switchView); setupView(cursor, view, switchView);
return view; return view;
@ -95,11 +95,9 @@ public class RepoAdapter extends CursorAdapter {
(RelativeLayout.LayoutParams)nameView.getLayoutParams(); (RelativeLayout.LayoutParams)nameView.getLayoutParams();
nameViewLayout.addRule(LayoutCompat.RelativeLayout.START_OF, switchView.getId()); nameViewLayout.addRule(LayoutCompat.RelativeLayout.START_OF, switchView.getId());
// If we set the signed view to GONE instead of INVISIBLE, then the
// height of each list item varies.
TextView signedView = (TextView) view.findViewById(R.id.repo_unsigned); TextView signedView = (TextView) view.findViewById(R.id.repo_unsigned);
if (repo.isSigned()) { if (repo.isSigned()) {
signedView.setVisibility(View.INVISIBLE); signedView.setVisibility(View.GONE);
} else if (repo.isSignedButUnverified()) { } else if (repo.isSignedButUnverified()) {
signedView.setText(R.string.unverified); signedView.setText(R.string.unverified);
signedView.setTextColor(view.getResources().getColor(R.color.unverified)); signedView.setTextColor(view.getResources().getColor(R.color.unverified));