Refactoring

pull/198/head
M66B 4 years ago
parent 97caad38f1
commit 47c3f59488

@ -89,7 +89,7 @@ public class ActivitySignature extends ActivityBase {
etText.setSelectionListener(new EditTextCompose.ISelection() { etText.setSelectionListener(new EditTextCompose.ISelection() {
@Override @Override
public void onSelected(boolean selection) { public void onSelected(boolean selection) {
style_bar.setVisibility(selection && !etText.getRaw() ? View.VISIBLE : View.GONE); style_bar.setVisibility(selection && !etText.isRaw() ? View.VISIBLE : View.GONE);
} }
}); });
@ -191,7 +191,7 @@ public class ActivitySignature extends ActivityBase {
@Override @Override
protected void onSaveInstanceState(Bundle outState) { protected void onSaveInstanceState(Bundle outState) {
outState.putBoolean("fair:raw", etText.getRaw()); outState.putBoolean("fair:raw", etText.isRaw());
super.onSaveInstanceState(outState); super.onSaveInstanceState(outState);
} }
@ -232,7 +232,7 @@ public class ActivitySignature extends ActivityBase {
String html = getIntent().getStringExtra("html"); String html = getIntent().getStringExtra("html");
if (html == null) if (html == null)
etText.setText(null); etText.setText(null);
else if (etText.getRaw()) else if (etText.isRaw())
etText.setText(html); etText.setText(html);
else else
etText.setText(HtmlHelper.fromHtml(html, new Html.ImageGetter() { etText.setText(HtmlHelper.fromHtml(html, new Html.ImageGetter() {
@ -276,7 +276,7 @@ public class ActivitySignature extends ActivityBase {
private String getHtml() { private String getHtml() {
etText.clearComposingText(); etText.clearComposingText();
if (etText.getRaw()) if (etText.isRaw())
return etText.getText().toString(); return etText.getText().toString();
else { else {
String html = HtmlHelper.toHtml(etText.getText(), this); String html = HtmlHelper.toHtml(etText.getText(), this);
@ -341,7 +341,7 @@ public class ActivitySignature extends ActivityBase {
getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
int start = etText.getSelectionStart(); int start = etText.getSelectionStart();
if (etText.getRaw()) if (etText.isRaw())
etText.getText().insert(start, "<img src=\"" + Html.escapeHtml(uri.toString()) + "\" />"); etText.getText().insert(start, "<img src=\"" + Html.escapeHtml(uri.toString()) + "\" />");
else { else {
SpannableStringBuilder ssb = new SpannableStringBuilder(etText.getText()); SpannableStringBuilder ssb = new SpannableStringBuilder(etText.getText());

@ -78,7 +78,7 @@ public class EditTextCompose extends FixedEditText {
this.raw = raw; this.raw = raw;
} }
public boolean getRaw() { public boolean isRaw() {
return raw; return raw;
} }

Loading…
Cancel
Save