private void init(View root) { boolean bUpdateData = (m_mailList == null); if (bUpdateData) { m_mailList = new Vector<glitchMail>(); } m_adapter = new MailboxListViewAdapter(this, m_mailList); m_listView = (LinearListView) root.findViewById(R.id.mailbox_list); m_listView.setAdapter(m_adapter); if (bUpdateData) { getInbox(false); } else { showMailboxPage(); } m_mailboxHeader = (TextView) m_root.findViewById(R.id.mailbox_header); m_mailboxHeader.setTypeface(m_application.m_vagFont); m_mailboxUnread = (TextView) m_root.findViewById(R.id.mailbox_unread); m_mailboxUnread.setTypeface(m_application.m_vagFont); m_btnCompose = (Button) m_root.findViewById(R.id.btnComposeMail); m_btnCompose.setVisibility(View.VISIBLE); m_btnCompose.setOnClickListener( new OnClickListener() { public void onClick(View arg0) { FlurryAgent.logEvent("Mail - 'Compose' button pressed"); composeMail(); } }); }
private void showMailboxPage() { boolean bHas = m_mailList.size() > 0; m_root.findViewById(R.id.mailbox_list_message).setVisibility(bHas ? View.GONE : View.VISIBLE); m_listView.setVisibility(bHas ? View.VISIBLE : View.GONE); if (bHas) m_adapter.notifyDataSetChanged(); if (m_bAppendMode) { ScrollView sv = (ScrollView) m_root.findViewById(R.id.MailboxScrollView); Util.delayedFlingOfScrollView(sv, 500, 500); } // Update message count? // Update unread count? }