Edit plain text

This commit is contained in:
M66B 2020-03-18 08:38:04 +01:00
parent 66b6bea31d
commit 09367da85f
21 changed files with 126 additions and 62 deletions

View File

@ -0,0 +1,64 @@
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2020 by Marcel Bokhorst (M66B)
*/
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.util.AttributeSet;
import androidx.appcompat.widget.AppCompatEditText;
public class EditTextPlain extends AppCompatEditText {
public EditTextPlain(Context context) {
super(context);
}
public EditTextPlain(Context context, AttributeSet attrs) {
super(context, attrs);
}
public EditTextPlain(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean onTextContextMenuItem(int id) {
try {
if (id == android.R.id.paste) {
Context context = getContext();
ClipboardManager cbm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
if (cbm != null && cbm.hasPrimaryClip()) {
ClipData data = cbm.getPrimaryClip();
ClipData.Item item = data.getItemAt(0);
CharSequence text = item.coerceToText(context);
data = ClipData.newPlainText("coerced_plain_text", text);
cbm.setPrimaryClip(data);
}
}
return super.onTextContextMenuItem(id);
} catch (Throwable ex) {
Log.w(ex);
return false;
}
}
}

View File

@ -56,7 +56,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbDownload" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSyncDays"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -78,7 +78,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etSyncDays" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etKeepDays"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -17,7 +17,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSearch"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -15,7 +15,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etLink"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -29,7 +29,7 @@
app:layout_constraintTop_toBottomOf="@id/tvOpenLink">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
<eu.faircode.email.FixedTextView
android:id="@+id/tvInsecure"

View File

@ -15,7 +15,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etKeyword"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -29,5 +29,5 @@
app:layout_constraintTop_toBottomOf="@id/tvKeyword">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -53,7 +53,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/baseline_bookmarks_24" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etLink"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -15,7 +15,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPin"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -15,7 +15,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPin"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -66,7 +66,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDomain" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etDomain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -124,7 +124,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvImap" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etHost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -192,7 +192,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInsecureRemark" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -216,7 +216,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etPort" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etUser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -325,7 +325,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOAuthSupport" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etRealm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -358,7 +358,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvName" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -512,7 +512,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAutoSeen" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etInterval"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -11,7 +11,7 @@
android:layout_height="match_parent"
app:layout_behavior="eu.faircode.email.BehaviorBottomPadding">
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -32,7 +32,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etExtra"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -175,7 +175,7 @@
app:layout_constraintTop_toTopOf="@+id/etBcc"
app:srcCompat="@drawable/baseline_person_add_24" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -43,7 +43,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvParent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -64,7 +64,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etName" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etDisplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -152,7 +152,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPoll"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -230,7 +230,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvSyncDaysRemark" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSyncDays"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -264,7 +264,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvKeepDays" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etKeepDays"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -47,7 +47,7 @@
app:layout_constraintStart_toEndOf="@id/btnGrant"
app:layout_constraintTop_toTopOf="@id/btnGrant" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -61,7 +61,7 @@
app:layout_constraintTop_toBottomOf="@+id/btnGrant">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
<Button
android:id="@+id/btnSelect"

View File

@ -45,7 +45,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAccount" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -69,7 +69,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etName" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etEmail"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -92,7 +92,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etEmail" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etDisplay"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -218,7 +218,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDomain" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etDomain"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -275,7 +275,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSmtp" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etHost"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -344,7 +344,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInsecureRemark" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPort"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -369,7 +369,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etPort" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etUser"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -467,7 +467,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnOAuth" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etRealm"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -534,7 +534,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSenderExtra" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSenderExtra"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -566,7 +566,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSenderExtraHint" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etReplyTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -588,7 +588,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etReplyTo" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etBcc"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -23,7 +23,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -37,9 +37,9 @@
app:layout_constraintTop_toBottomOf="@id/tvGrantHint">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etEmail"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -53,7 +53,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDoubleBack" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etDefaultSnooze"
android:layout_width="100dp"
android:layout_height="wrap_content"

View File

@ -172,7 +172,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTimeout" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etTimeout"
android:layout_width="100dp"
android:layout_height="wrap_content"
@ -218,7 +218,7 @@
app:layout_constraintTop_toBottomOf="@id/tvSslHardenHint"
app:switchPadding="12dp" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSocks"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -33,7 +33,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPopSupport" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etHost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -101,7 +101,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInsecureRemark" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etPort"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -125,7 +125,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etPort" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etUser"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -196,7 +196,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvName" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -327,7 +327,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbLeaveDevice" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etMax"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -349,7 +349,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etMax" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etInterval"
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -13,7 +13,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -27,9 +27,9 @@
app:layout_constraintTop_toTopOf="parent">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etEmail"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -60,7 +60,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFolder" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etName"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -80,7 +80,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etName" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etOrder"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -142,7 +142,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorSender" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSender"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -215,7 +215,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorRecipient" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etRecipient"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -280,7 +280,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorSubject" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -360,7 +360,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHeader" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etHeader"
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -567,7 +567,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spImportance" />
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etKeyword"
android:layout_width="0dp"
android:layout_height="wrap_content"

View File

@ -6,7 +6,7 @@
android:background="?attr/colorActionBackground"
android:padding="12dp">
<EditText
<eu.faircode.email.EditTextPlain
android:id="@+id/etSearch"
android:layout_width="150dp"
android:layout_height="wrap_content"
@ -16,7 +16,7 @@
app:layout_constraintTop_toTopOf="parent">
<requestFocus />
</EditText>
</eu.faircode.email.EditTextPlain>
<ImageButton
android:id="@+id/ibNext"