mirror of https://github.com/M66B/FairEmail.git
Made custom rendering an experiment
This commit is contained in:
parent
bd0b1e5c11
commit
a6e4296b1d
2
FAQ.md
2
FAQ.md
|
@ -2537,7 +2537,7 @@ Reformatting and displaying such messages will take too long. You can try to use
|
|||
<a name="faq125"></a>
|
||||
**(125) What are the current experimental features?**
|
||||
|
||||
Currently, there are no experimental features.
|
||||
* Custom rendering of reformatted messages
|
||||
|
||||
<br />
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ public class ActivityEML extends ActivityBase {
|
|||
if (html != null) {
|
||||
Document parsed = JsoupEx.parse(html);
|
||||
Document document = HtmlHelper.sanitizeView(context, parsed, false);
|
||||
result.body = HtmlHelper.fromDocument(document);
|
||||
result.body = HtmlHelper.fromDocument(context, document);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -1924,7 +1924,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
}
|
||||
|
||||
// Draw images
|
||||
Spanned spanned = HtmlHelper.fromDocument(document, new Html.ImageGetter() {
|
||||
Spanned spanned = HtmlHelper.fromDocument(context, document, new Html.ImageGetter() {
|
||||
@Override
|
||||
public Drawable getDrawable(String source) {
|
||||
Drawable drawable = ImageHelper.decodeImage(context, message.id, source, show_images, zoom, tvBody);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class EditTextCompose extends FixedEditText {
|
|||
html = "<div>" + HtmlHelper.formatPre(text.toString()) + "</div>";
|
||||
}
|
||||
Document document = HtmlHelper.sanitizeCompose(context, html, false);
|
||||
Spanned paste = HtmlHelper.fromDocument(document);
|
||||
Spanned paste = HtmlHelper.fromDocument(context, document);
|
||||
|
||||
int colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||
|
||||
|
|
|
@ -1756,12 +1756,15 @@ public class HtmlHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
static Spanned fromDocument(@NonNull Document document) {
|
||||
return fromDocument(document, null, null);
|
||||
static Spanned fromDocument(Context context, @NonNull Document document) {
|
||||
return fromDocument(context, document, null, null);
|
||||
}
|
||||
|
||||
static Spanned fromDocument(@NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
static Spanned fromDocument(Context context, @NonNull Document document, @Nullable Html.ImageGetter imageGetter, @Nullable Html.TagHandler tagHandler) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean experiments = prefs.getBoolean("experiments", false);
|
||||
|
||||
if (experiments) {
|
||||
// https://developer.android.com/guide/topics/text/spans
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder();
|
||||
|
||||
|
|
|
@ -187,9 +187,7 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_experiments"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swUpdates"
|
||||
|
@ -205,7 +203,6 @@
|
|||
android:text="@string/title_advanced_experiments_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorLink"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swExperiments" />
|
||||
|
||||
|
|
Loading…
Reference in New Issue