permanent notification disapears now when account is being deleted + code clean up

This commit is contained in:
Daniel Gultsch 2014-05-17 10:03:15 +02:00
parent b84b67268b
commit 8bf0945f2f
3 changed files with 9 additions and 16 deletions

View file

@ -1156,8 +1156,11 @@ public class XmppConnectionService extends Service {
this.statusListener.onStatusChanged(account); this.statusListener.onStatusChanged(account);
databaseBackend.updateAccount(account); databaseBackend.updateAccount(account);
reconnectAccount(account, false); reconnectAccount(account, false);
if (accountChangedListener != null) if (accountChangedListener != null) {
accountChangedListener.onAccountListChangedListener(); accountChangedListener.onAccountListChangedListener();
}
UIHelper.showErrorNotification(getApplicationContext(),
getAccounts());
} }
public void deleteAccount(Account account) { public void deleteAccount(Account account) {
@ -1166,8 +1169,11 @@ public class XmppConnectionService extends Service {
} }
databaseBackend.deleteAccount(account); databaseBackend.deleteAccount(account);
this.accounts.remove(account); this.accounts.remove(account);
if (accountChangedListener != null) if (accountChangedListener != null) {
accountChangedListener.onAccountListChangedListener(); accountChangedListener.onAccountListChangedListener();
}
UIHelper.showErrorNotification(getApplicationContext(),
getAccounts());
} }
public void setOnConversationListChangedListener( public void setOnConversationListChangedListener(

View file

@ -757,7 +757,6 @@ public class ConversationFragment extends Fragment {
private class BitmapCache { private class BitmapCache {
private HashMap<String, Bitmap> bitmaps = new HashMap<String, Bitmap>(); private HashMap<String, Bitmap> bitmaps = new HashMap<String, Bitmap>();
private Bitmap error = null;
public Bitmap get(String name, Contact contact, Context context) { public Bitmap get(String name, Contact contact, Context context) {
if (bitmaps.containsKey(name)) { if (bitmaps.containsKey(name)) {

View file

@ -12,7 +12,6 @@ import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Conversation;
import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.MucOptions;
import eu.siacs.conversations.entities.MucOptions.User; import eu.siacs.conversations.entities.MucOptions.User;
import eu.siacs.conversations.ui.ConversationActivity; import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.ui.ManageAccountActivity; import eu.siacs.conversations.ui.ManageAccountActivity;
@ -27,7 +26,6 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
@ -38,11 +36,9 @@ import android.net.Uri;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.ContactsContract.Contacts; import android.provider.ContactsContract.Contacts;
import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.InboxStyle;
import android.support.v4.app.TaskStackBuilder; import android.support.v4.app.TaskStackBuilder;
import android.text.Html; import android.text.Html;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@ -235,10 +231,6 @@ public class UIHelper {
return bitmap; return bitmap;
} }
private static Bitmap getUnknownContactPicture(String[] names, int size) {
return getUnknownContactPicture(names, size, UIHelper.BG_COLOR, UIHelper.FG_COLOR);
}
private static Bitmap getMucContactPicture(Conversation conversation, int size, int bgColor, int fgColor) { private static Bitmap getMucContactPicture(Conversation conversation, int size, int bgColor, int fgColor) {
List<User> members = conversation.getMucOptions().getUsers(); List<User> members = conversation.getMucOptions().getUsers();
if (members.size() == 0) { if (members.size() == 0) {
@ -273,10 +265,6 @@ public class UIHelper {
} }
public static Bitmap getContactPicture(Contact contact, int dpSize, Context context, boolean notification) { public static Bitmap getContactPicture(Contact contact, int dpSize, Context context, boolean notification) {
int fgColor = UIHelper.FG_COLOR,
bgColor = (notification) ?
UIHelper.BG_COLOR : UIHelper.TRANSPARENT;
String uri = contact.getProfilePhoto(); String uri = contact.getProfilePhoto();
if (uri==null) { if (uri==null) {
return getContactPicture(contact.getDisplayName(), dpSize, return getContactPicture(contact.getDisplayName(), dpSize,