private void init() { setVerticalFadingEdgeEnabled(false); headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null); header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header); text = (TextView) header.findViewById(R.id.ptr_id_text); lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated); image = (ImageView) header.findViewById(R.id.ptr_id_image); spinner = (ProgressBar) header.findViewById(R.id.ptr_id_spinner); pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh); releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh); refreshingText = getContext().getString(R.string.ptr_refreshing); lastUpdatedText = getContext().getString(R.string.ptr_last_updated); flipAnimation = new RotateAnimation( 0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); flipAnimation.setInterpolator(new LinearInterpolator()); flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); flipAnimation.setFillAfter(true); reverseFlipAnimation = new RotateAnimation( -180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f); reverseFlipAnimation.setInterpolator(new LinearInterpolator()); reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION); reverseFlipAnimation.setFillAfter(true); addHeaderView(headerContainer); setState(State.PULL_TO_REFRESH); scrollbarEnabled = isVerticalScrollBarEnabled(); ViewTreeObserver vto = header.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener()); super.setOnItemClickListener(new PTROnItemClickListener()); super.setOnItemLongClickListener(new PTROnItemLongClickListener()); }
public View getView(int position, View convertView, ViewGroup parent) { RelativeLayout rowLayout; ServiceAcctInfo acct = acctList[position]; if (convertView == null) { rowLayout = (RelativeLayout) LayoutInflater.from(context).inflate(R.layout.realm_login_row, parent, false); } else { rowLayout = (RelativeLayout) convertView; } String acctType = msgsetNames[acct.type.ordinal()]; if (acct.name.acctType != null) acctType = acctType + " (" + acct.name.acctType + ')'; if (acct.name.acctId != null) acctType = acctType + "\nAccount: " + acct.name.acctId; ((TextView) rowLayout.findViewById(R.id.Name)).setText(acct.desc); ((TextView) rowLayout.findViewById(R.id.TaskList)).setText(acctType); return rowLayout; }