/soc/2012/michael/android: 7943181bb906: dded AccountListAdapter...

Michael Zangl michael at soc.pidgin.im
Sat Jul 7 13:00:48 EDT 2012


Changeset: 7943181bb906734d5425cc840f50956630c21324
Author:	 Michael Zangl <michael at soc.pidgin.im>
Date:	 2012-07-07 19:00 +0200
Branch:	 soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/7943181bb906

Description:

dded AccountListAdapter to the account list view, so that active accounts are displayed.

diffstat:

 android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java            |   9 +-
 android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/accountlist/AccountListView.java |  41 +++++++--
 2 files changed, 37 insertions(+), 13 deletions(-)

diffs (103 lines):

diff --git a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
--- a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
+++ b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/PurpleTestClient.java
@@ -31,9 +31,14 @@
 					getFilesDir());
 		}
 
+		try {
+			Thread.sleep(500);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
 		printStats();
 
-		displayAccountList();
+		showView(new AccountListView(this, true));
 	}
 
 	private void printStats() {
@@ -95,7 +100,7 @@
 
 	@Override
 	public void displayAccountList() {
-		showView(new AccountListView(this));
+		showView(new AccountListView(this, false));
 	}
 
 	@Override
diff --git a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/accountlist/AccountListView.java b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/accountlist/AccountListView.java
--- a/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/accountlist/AccountListView.java
+++ b/android/workspace/im.pidgin.libpurple.testclient/src/im/pidgin/libpurple/testclient/accountlist/AccountListView.java
@@ -1,41 +1,60 @@
 package im.pidgin.libpurple.testclient.accountlist;
 
+import im.pidgin.libpurple.testclient.R;
+import im.pidgin.libpurple.testclient.core.TestClientView;
+import im.pidgin.libpurple.testclient.core.ViewController;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
-import im.pidgin.libpurple.testclient.R;
-import im.pidgin.libpurple.testclient.core.TestClientView;
-import im.pidgin.libpurple.testclient.core.ViewController;
+import android.widget.ListView;
 
 public class AccountListView implements TestClientView {
 
 	private final ViewController viewController;
+	private final boolean withBListButton;
 
-	public AccountListView(ViewController viewController) {
+	public AccountListView(ViewController viewController,
+			boolean withBListButton) {
 		this.viewController = viewController;
+		this.withBListButton = withBListButton;
 	}
 
 	@Override
 	public View createView() {
-		View root = viewController.getLayoutInflater().inflate(R.layout.accountlist, null);
-		
-		Button newButton = (Button) root.findViewById(R.id.accountlist_newButton);
+		View root = viewController.getLayoutInflater().inflate(
+				R.layout.accountlist, null);
+
+		Button newButton = (Button) root
+				.findViewById(R.id.accountlist_newButton);
 		newButton.setOnClickListener(new OnClickListener() {
 			@Override
 			public void onClick(View v) {
 				viewController.displayNewAccountDialog();
 			}
 		});
-		
-		//TODO: to-blist-button, accountlist.
-		
+
+		ListView list = (ListView) root.findViewById(R.id.accountlist);
+		list.setAdapter(new AccountListAdapter(viewController, true));
+
+		Button toBlistButton = (Button) root
+				.findViewById(R.id.accountlist_buddyListButton);
+		if (withBListButton) {
+			toBlistButton.setOnClickListener(new OnClickListener() {
+				@Override
+				public void onClick(View v) {
+					viewController.displayBuddylist();
+				}
+			});
+		} else {
+			toBlistButton.setVisibility(View.GONE);
+		}
 		return root;
 	}
 
 	@Override
 	public void removed(View view) {
 		// TODO Auto-generated method stub
-		
+
 	}
 
 }



More information about the Commits mailing list