--- a/src/com/beem/project/beem/BeemService.java Tue Oct 25 01:41:19 2011 +0200
+++ b/src/com/beem/project/beem/BeemService.java Tue Oct 25 02:16:45 2011 +0200
@@ -437,6 +437,7 @@
}
break;
case MESSAGE_SYNC:
+ BeemNotification.StartSyncNotification(getBaseContext());
String accountName = b.getString(BeemIntent.EXTRA_ACCOUNT);
//TODO: Connect with option to not show status
handleConnect(accountName);
@@ -446,6 +447,7 @@
if (co.getAdaptee() != null)
sync.manageRoster(co.getAdaptee().getRoster(), accountName);
}
+ BeemNotification.StopSyncNotification(getBaseContext());
break;
default:
Log.w(TAG, "Unknown message " + msg);
--- a/src/com/beem/project/beem/BeemSync.java Tue Oct 25 01:41:19 2011 +0200
+++ b/src/com/beem/project/beem/BeemSync.java Tue Oct 25 02:16:45 2011 +0200
@@ -51,6 +51,7 @@
import android.util.Log;
import com.beem.project.beem.service.BeemAvatarCache;
+import com.beem.project.beem.ui.BeemNotification;
import com.beem.project.beem.utils.Status;
/**
--- a/src/com/beem/project/beem/ui/BeemNotification.java Tue Oct 25 01:41:19 2011 +0200
+++ b/src/com/beem/project/beem/ui/BeemNotification.java Tue Oct 25 02:16:45 2011 +0200
@@ -54,10 +54,10 @@
*/
protected BeemNotification(Context c) {
super();
-
- mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
+ mContext = c;
+ mNotificationManager = (NotificationManager) c.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent();
- contentIntent = PendingIntent.getActivity(mContext, (int) System.currentTimeMillis(), notificationIntent,
+ contentIntent = PendingIntent.getActivity(c, (int) System.currentTimeMillis(), notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
icon = R.drawable.beem_status_icon;
flags = Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT;
@@ -73,9 +73,21 @@
instance.mNotificationManager.notify(R.string.app_name, instance);
}
-
- public static void SyncNotification(Context c) {
-
+
+ public static void StartSyncNotification(Context c) {
+ if (instance == null) {
+ instance = new BeemNotification(c);
+ }
+ instance.icon = R.drawable.ic_menu_sync;
+ instance.mNotificationManager.notify(R.string.app_name, instance);
+ }
+
+ public static void StopSyncNotification(Context c) {
+ if (instance == null) {
+ instance = new BeemNotification(c);
+ }
+ instance.icon = R.drawable.beem_status_icon;
+ instance.mNotificationManager.notify(R.string.app_name, instance);
}
public void deleteNotification(int id) {
--- a/src/com/beem/project/beem/ui/ContactList.java Tue Oct 25 01:41:19 2011 +0200
+++ b/src/com/beem/project/beem/ui/ContactList.java Tue Oct 25 02:16:45 2011 +0200
@@ -201,7 +201,7 @@
return true;
case R.id.contact_list_menu_sync:
//TODO: Manual Sync operation
- Log.i(TAG, "performSync: " + mAccountName);
+ Log.i(TAG, "performSync: " + mAccountName);
Intent intent = new Intent(BeemIntent.ACTION_SYNC);
intent.putExtra(BeemIntent.EXTRA_ACCOUNT, mAccountName);
startService(intent);
@@ -313,7 +313,7 @@
View v = stub.inflate();
Gallery g = (Gallery) v.findViewById(R.id.contactlist_banner);
g.setOnItemClickListener(new OnItemClickGroupName());
- g.setAdapter(mAdapterBanner);
+ g.setAdapter(mAdapterBanner);
} else {
((LinearLayout) findViewById(R.id.contactlist_groupstub)).setVisibility(View.VISIBLE);
Gallery g = (Gallery) findViewById(R.id.contactlist_banner);