MCPcopy Create free account
hub / github.com/M66B/FairEmail / set

Method set

app/src/main/java/eu/faircode/email/AdapterLog.java:103–174  ·  view source on GitHub ↗
(@NonNull List<EntityLog> logs,
                    Long account, Long folder, Long message,
                    @NonNull List<EntityLog.Type> types,
                    Runnable callback)

Source from the content-addressed store, hash-verified

101 }
102
103 public void set(@NonNull List<EntityLog> logs,
104 Long account, Long folder, Long message,
105 @NonNull List<EntityLog.Type> types,
106 Runnable callback) {
107 Log.i("Set logs=" + logs.size());
108
109 this.all = logs;
110 this.account = account;
111 this.folder = folder;
112 this.message = message;
113 this.types = types;
114
115 new SimpleTask<List<EntityLog>>() {
116 @Override
117 protected List<EntityLog> onExecute(Context context, Bundle args) throws Throwable {
118 List<EntityLog> items = new ArrayList<>();
119 for (EntityLog log : logs)
120 if (account == null && folder == null && message == null) {
121 if (types.contains(log.type))
122 items.add(log);
123 } else {
124 if ((account == null || account.equals(log.account)) &&
125 (folder == null || folder.equals(log.folder)) &&
126 (message == null || message.equals(log.message)))
127 items.add(log);
128 }
129 return items;
130 }
131
132 @Override
133 protected void onExecuted(Bundle args, List<EntityLog> items) {
134 DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(selected, items), false);
135
136 selected = items;
137
138 diff.dispatchUpdatesTo(new ListUpdateCallback() {
139 @Override
140 public void onInserted(int position, int count) {
141 Log.d("Inserted @" + position + " #" + count);
142 }
143
144 @Override
145 public void onRemoved(int position, int count) {
146 Log.d("Removed @" + position + " #" + count);
147 }
148
149 @Override
150 public void onMoved(int fromPosition, int toPosition) {
151 Log.d("Moved " + fromPosition + ">" + toPosition);
152 }
153
154 @Override
155 public void onChanged(int position, int count, Object payload) {
156 Log.d("Changed @" + position + " #" + count);
157 }
158 });
159
160 try {

Callers 15

setTypesMethod · 0.95
initMethod · 0.45
getScheduleMethod · 0.45
getItemOffsetsMethod · 0.45
onClickMethod · 0.45
setAndAllowWhileIdleMethod · 0.45
setPasswordMethod · 0.45
setOptionsMethod · 0.45
onChangedMethod · 0.45
formatHourMethod · 0.45
onDateSetMethod · 0.45
onChangedMethod · 0.45

Calls 4

iMethod · 0.95
serialMethod · 0.80
sizeMethod · 0.65
executeMethod · 0.45

Tested by

no test coverage detected