# HG changeset patch # User "Vincent Veronis" # Date 1319501805 -7200 # Node ID e5c194ea930732380b05b9c59b9c24b24e6e762f # Parent 9458ad77117fc1ad2385cc989ee9270713b1f298 Change notification icon status when sync roster diff -r 9458ad77117f -r e5c194ea9307 src/com/beem/project/beem/BeemService.java --- 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); diff -r 9458ad77117f -r e5c194ea9307 src/com/beem/project/beem/BeemSync.java --- 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; /** diff -r 9458ad77117f -r e5c194ea9307 src/com/beem/project/beem/ui/BeemNotification.java --- 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) { diff -r 9458ad77117f -r e5c194ea9307 src/com/beem/project/beem/ui/ContactList.java --- 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);