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

Class ActivitySignature

app/src/main/java/eu/faircode/email/ActivitySignature.java:68–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66import java.util.Objects;
67
68public class ActivitySignature extends ActivityBase {
69 private ViewGroup view;
70 private TextView tvHtmlRemark;
71 private EditTextCompose etText;
72 private ImageButton ibFull;
73 private HorizontalScrollView style_bar;
74 private BottomNavigationView bottom_navigation;
75
76 private boolean loaded = false;
77 private boolean dirty = false;
78 private String saved = null;
79
80 private static final int REQUEST_IMAGE = 1;
81 private static final int REQUEST_FILE = 2;
82 private static final int REQUEST_LINK = 3;
83
84 @Override
85 protected void onCreate(Bundle savedInstanceState) {
86 super.onCreate(savedInstanceState);
87
88 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
89 boolean monospaced = prefs.getBoolean("monospaced", false);
90
91 LayoutInflater inflater = LayoutInflater.from(this);
92 view = (ViewGroup) inflater.inflate(R.layout.activity_signature, null, false);
93 setContentView(view);
94
95 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
96 getSupportActionBar().setSubtitle(getString(R.string.title_edit_signature));
97
98 tvHtmlRemark = findViewById(R.id.tvHtmlRemark);
99 etText = findViewById(R.id.etText);
100 ibFull = findViewById(R.id.ibFull);
101 style_bar = findViewById(R.id.style_bar);
102 bottom_navigation = findViewById(R.id.bottom_navigation);
103
104 etText.setTypeface(monospaced ? StyleHelper.getTypeface("monospace", this) : Typeface.DEFAULT);
105
106 etText.setSelectionListener(new EditTextCompose.ISelection() {
107 @Override
108 public void onSelected(boolean selection) {
109 style_bar.setVisibility(selection && !etText.isRaw() ? View.VISIBLE : View.GONE);
110 }
111 });
112
113 etText.addTextChangedListener(StyleHelper.getTextWatcher(etText));
114
115 etText.addTextChangedListener(new TextWatcher() {
116 @Override
117 public void beforeTextChanged(CharSequence s, int start, int count, int after) {
118 // Do nothing
119 }
120
121 @Override
122 public void onTextChanged(CharSequence s, int start, int before, int count) {
123 if (loaded &&
124 !(start == 0 && before == s.length() && count == s.length())) {
125 dirty = true;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected