mirror of https://github.com/M66B/FairEmail.git
Updated all message lists on keyword color change
This commit is contained in:
parent
84b8fbbd82
commit
945a868154
|
@ -21,6 +21,7 @@ package eu.faircode.email;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -31,6 +32,7 @@ import android.widget.CompoundButton;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.recyclerview.widget.DiffUtil;
|
||||
import androidx.recyclerview.widget.ListUpdateCallback;
|
||||
|
@ -165,6 +167,9 @@ public class AdapterKeyword extends RecyclerView.Adapter<AdapterKeyword.ViewHold
|
|||
prefs.edit().remove("keyword." + keyword.name).apply();
|
||||
else
|
||||
prefs.edit().putInt("keyword." + keyword.name, keyword.color).apply();
|
||||
|
||||
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(context);
|
||||
lbm.sendBroadcast(new Intent(FragmentMessages.ACTION_KEYWORDS));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4166,7 +4166,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
FragmentDialogKeywordManage fragment = new FragmentDialogKeywordManage();
|
||||
fragment.setArguments(args);
|
||||
fragment.setTargetFragment(parentFragment, FragmentMessages.REQUEST_KEYWORDS);
|
||||
fragment.show(parentFragment.getParentFragmentManager(), "keyword:manage");
|
||||
}
|
||||
|
||||
|
|
|
@ -324,10 +324,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
private static final int REQUEST_EMPTY_FOLDER = 20;
|
||||
private static final int REQUEST_BOUNDARY_RETRY = 21;
|
||||
static final int REQUEST_PICK_CONTACT = 22;
|
||||
static final int REQUEST_KEYWORDS = 23;
|
||||
|
||||
static final String ACTION_STORE_RAW = BuildConfig.APPLICATION_ID + ".STORE_RAW";
|
||||
static final String ACTION_DECRYPT = BuildConfig.APPLICATION_ID + ".DECRYPT";
|
||||
static final String ACTION_KEYWORDS = BuildConfig.APPLICATION_ID + ".KEYWORDS";
|
||||
|
||||
private static final long REVIEW_ASK_DELAY = 21 * 24 * 3600 * 1000L; // milliseconds
|
||||
private static final long REVIEW_LATER_DELAY = 3 * 24 * 3600 * 1000L; // milliseconds
|
||||
|
@ -3184,6 +3184,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
IntentFilter iff = new IntentFilter();
|
||||
iff.addAction(ACTION_STORE_RAW);
|
||||
iff.addAction(ACTION_DECRYPT);
|
||||
iff.addAction(ACTION_KEYWORDS);
|
||||
lbm.registerReceiver(receiver, iff);
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
@ -4829,6 +4830,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
onStoreRaw(intent);
|
||||
else if (ACTION_DECRYPT.equals(action))
|
||||
onDecrypt(intent);
|
||||
else if (ACTION_KEYWORDS.equals(action))
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -5050,9 +5053,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
if (resultCode == RESULT_OK && data != null)
|
||||
onPickContact(data.getData());
|
||||
break;
|
||||
case REQUEST_KEYWORDS:
|
||||
adapter.notifyDataSetChanged();
|
||||
break;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
|
|
Loading…
Reference in New Issue