From ca144b770e1848d2f5aa88f5b3deea0df8dd1d72 Mon Sep 17 00:00:00 2001 From: Henry Addo Date: Fri, 9 Aug 2013 13:16:22 +0900 Subject: [PATCH] Disabled the donation menu item for now as there is no public key for it yet --- .../smssync/activities/BaseActivity.java | 63 ++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/smssync/src/main/java/org/addhen/smssync/activities/BaseActivity.java b/smssync/src/main/java/org/addhen/smssync/activities/BaseActivity.java index b6c19d980..a22756c8e 100644 --- a/smssync/src/main/java/org/addhen/smssync/activities/BaseActivity.java +++ b/smssync/src/main/java/org/addhen/smssync/activities/BaseActivity.java @@ -45,6 +45,7 @@ import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; +import android.os.Handler; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; @@ -261,7 +262,66 @@ public void openActivityOrFragment(Intent intent) { protected void createNavDrawer() { navDrawerAdapter = new NavDrawerAdapter(this); - new NavDrawerItemTask(this).execute((String) null); + //new NavDrawerItemTask(this).execute((String) null); + final PendingMessagesNavDrawerItem pendingMessagesNavDrawerItem; + + final SentMessagesNavDrawerItem sentMessagesNavDrawerItem; + + final SyncUrlNavDrawerItem syncUrlNavDrawerItem; + + //final DonationNavDrawerItem donationNavDrawerItem; + + final BlacklistNavDrawerItem filterNavDrawerItem; + + final WhitelistNavDrawerItem whitelistNavDrawerItem; + + final List navDrawerItem; + + pendingMessagesNavDrawerItem + = new PendingMessagesNavDrawerItem( + getString(R.string.pending_messages), + R.drawable.pending, BaseActivity.this); + + sentMessagesNavDrawerItem = new SentMessagesNavDrawerItem( + getString(R.string.sent_messages), + R.drawable.sent, BaseActivity.this); + + syncUrlNavDrawerItem = new SyncUrlNavDrawerItem(getString( + R.string.sync_url), + R.drawable.sync_url, BaseActivity.this); + + /*donationNavDrawerItem = new DonationNavDrawerItem(getString(R.string.donate), + R.drawable.donate, BaseActivity.this);*/ + + filterNavDrawerItem = new BlacklistNavDrawerItem(getString(R.string.blacklist), + R.drawable.blacklist, BaseActivity.this); + + whitelistNavDrawerItem = new WhitelistNavDrawerItem(getString(R.string.whitelist), + R.drawable.whitelist, BaseActivity.this); + + navDrawerItem = new ArrayList(); + + new Handler().post(new Runnable(){ + + @Override + public void run() { + sentMessagesNavDrawerItem.setCounter(); + pendingMessagesNavDrawerItem.setCounter(); + syncUrlNavDrawerItem.setCounter(); + //donationNavDrawerItem.setCounter(); + filterNavDrawerItem.setCounter(); + whitelistNavDrawerItem.setCounter(); + navDrawerItem.add(pendingMessagesNavDrawerItem); + navDrawerItem.add(sentMessagesNavDrawerItem); + navDrawerItem.add(syncUrlNavDrawerItem); + //navDrawerItem.add(donationNavDrawerItem); + navDrawerItem.add(whitelistNavDrawerItem); + navDrawerItem.add(filterNavDrawerItem); + navDrawerAdapter.setItems(navDrawerItem); + listView.setAdapter(navDrawerAdapter); + selectItem(0); + } + }); initNavDrawer(); } @@ -421,6 +481,7 @@ public void onItemClick(AdapterView parent, android.view.View view, int posit } + //TODO:: remove this code at some point private class NavDrawerItemTask extends ProgressTask { PendingMessagesNavDrawerItem pendingMessagesNavDrawerItem;