mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-04 06:20:26 +00:00
Removed preview rebuild
This commit is contained in:
parent
3907975eea
commit
d97a9667f2
1 changed files with 0 additions and 34 deletions
|
@ -43,8 +43,6 @@ import android.widget.CompoundButton;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
|
@ -215,38 +213,6 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
prefs.edit().putBoolean("preview", checked).apply();
|
prefs.edit().putBoolean("preview", checked).apply();
|
||||||
if (checked)
|
|
||||||
new SimpleTask<Void>() {
|
|
||||||
@Override
|
|
||||||
protected Void onExecute(Context context, Bundle args) {
|
|
||||||
DB db = DB.getInstance(context);
|
|
||||||
|
|
||||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
boolean metered = (cm == null || cm.isActiveNetworkMetered());
|
|
||||||
|
|
||||||
for (Long id : db.message().getMessageWithoutPreview()) {
|
|
||||||
EntityMessage message = db.message().getMessage(id);
|
|
||||||
try {
|
|
||||||
Log.i("Building preview id=" + id);
|
|
||||||
String body = message.read(context);
|
|
||||||
db.message().setMessageContent(
|
|
||||||
message.id, true, HtmlHelper.getPreview(body));
|
|
||||||
} catch (IOException ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
db.message().setMessageContent(message.id, false, null);
|
|
||||||
if (!metered)
|
|
||||||
EntityOperation.queue(context, db, message, EntityOperation.BODY);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onException(Bundle args, Throwable ex) {
|
|
||||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
|
||||||
}
|
|
||||||
}.execute(FragmentOptions.this, new Bundle(), "options:preview");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue