Improved keyword management / keyword colors

This commit is contained in:
M66B 2020-01-27 22:43:46 +01:00
parent 46f23faf9a
commit 918bc628c6
9 changed files with 597 additions and 145 deletions

View File

@ -0,0 +1,308 @@
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.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.DiffUtil;
import androidx.recyclerview.widget.ListUpdateCallback;
import androidx.recyclerview.widget.RecyclerView;
import com.flask.colorpicker.ColorPickerView;
import com.flask.colorpicker.builder.ColorPickerClickListener;
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class AdapterKeyword extends RecyclerView.Adapter<AdapterKeyword.ViewHolder> {
private Context context;
private LifecycleOwner owner;
private LayoutInflater inflater;
private boolean pro;
private long id;
private List<TupleKeyword> all = new ArrayList<>();
public class ViewHolder extends RecyclerView.ViewHolder implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {
private View view;
private CheckBox cbKeyword;
private ViewButtonColor btnColor;
ViewHolder(View itemView) {
super(itemView);
view = itemView.findViewById(R.id.clItem);
cbKeyword = itemView.findViewById(R.id.cbKeyword);
btnColor = itemView.findViewById(R.id.btnColor);
}
private void wire() {
cbKeyword.setOnCheckedChangeListener(this);
btnColor.setOnClickListener(this);
}
private void unwire() {
cbKeyword.setOnCheckedChangeListener(null);
btnColor.setOnClickListener(null);
}
private void bindTo(TupleKeyword keyword) {
cbKeyword.setText(keyword.name);
cbKeyword.setChecked(keyword.selected);
cbKeyword.setEnabled(pro);
btnColor.setColor(keyword.color);
btnColor.setEnabled(pro);
}
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
TupleKeyword keyword = all.get(pos);
keyword.selected = isChecked;
Bundle args = new Bundle();
args.putLong("id", id);
args.putString("keyword", keyword.name);
args.putBoolean("selected", keyword.selected);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
String keyword = args.getString("keyword");
boolean selected = args.getBoolean("selected");
DB db = DB.getInstance(context);
EntityMessage message = db.message().getMessage(id);
if (message == null)
return null;
List<String> keywords = new ArrayList<>(Arrays.asList(message.keywords));
if (selected)
keywords.add(keyword);
else
keywords.remove(keyword);
db.message().setMessageKeywords(message.id, TextUtils.join(" ", keywords));
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.e(ex);
}
}.execute(context, owner, args, "keyword:set");
}
@Override
public void onClick(View view) {
int pos = getAdapterPosition();
if (pos == RecyclerView.NO_POSITION)
return;
final TupleKeyword keyword = all.get(pos);
ColorPickerDialogBuilder builder = ColorPickerDialogBuilder
.with(context)
.setTitle(context.getString(R.string.title_color))
.showColorEdit(true)
.wheelType(ColorPickerView.WHEEL_TYPE.FLOWER)
.density(6)
.lightnessSliderOnly()
.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
update(keyword, null);
}
})
.setPositiveButton(android.R.string.ok, new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int selectedColor, Integer[] allColors) {
update(keyword, selectedColor);
}
});
if (keyword.color != null)
builder.initialColor(keyword.color);
builder.build().show();
}
private void update(TupleKeyword keyword, Integer color) {
btnColor.setColor(color);
keyword.color = color;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (color == null)
prefs.edit().remove("keyword." + keyword.name).apply();
else
prefs.edit().putInt("keyword." + keyword.name, keyword.color).apply();
Bundle args = new Bundle();
args.putLong("id", id);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
DB db = DB.getInstance(context);
EntityMessage message = db.message().getMessage(id);
if (message == null)
return null;
// Update keyword colors
try {
db.beginTransaction();
db.message().setMessageKeywords(message.id, "");
db.message().setMessageKeywords(message.id, TextUtils.join(" ", message.keywords));
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.e(ex);
}
}.execute(context, owner, args, "keyword:set");
}
}
AdapterKeyword(Context context, LifecycleOwner owner) {
this.context = context;
this.owner = owner;
this.inflater = LayoutInflater.from(context);
this.pro = ActivityBilling.isPro(context);
setHasStableIds(false);
}
public void set(long id, @NonNull List<TupleKeyword> keywords) {
Log.i("Set id=" + id + " keywords=" + keywords.size());
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(all, keywords), false);
this.id = id;
this.all = keywords;
diff.dispatchUpdatesTo(new ListUpdateCallback() {
@Override
public void onInserted(int position, int count) {
Log.d("Inserted @" + position + " #" + count);
}
@Override
public void onRemoved(int position, int count) {
Log.d("Removed @" + position + " #" + count);
}
@Override
public void onMoved(int fromPosition, int toPosition) {
Log.d("Moved " + fromPosition + ">" + toPosition);
}
@Override
public void onChanged(int position, int count, Object payload) {
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
}
private class DiffCallback extends DiffUtil.Callback {
private List<TupleKeyword> prev = new ArrayList<>();
private List<TupleKeyword> next = new ArrayList<>();
DiffCallback(List<TupleKeyword> prev, List<TupleKeyword> next) {
this.prev.addAll(prev);
this.next.addAll(next);
}
@Override
public int getOldListSize() {
return prev.size();
}
@Override
public int getNewListSize() {
return next.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
TupleKeyword k1 = prev.get(oldItemPosition);
TupleKeyword k2 = next.get(newItemPosition);
return k1.name.equals(k2.name);
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
TupleKeyword k1 = prev.get(oldItemPosition);
TupleKeyword k2 = next.get(newItemPosition);
return k1.equals(k2);
}
}
@Override
public int getItemCount() {
return all.size();
}
@Override
@NonNull
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new ViewHolder(inflater.inflate(R.layout.item_keyword, parent, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.unwire();
TupleKeyword contact = all.get(position);
holder.bindTo(contact);
holder.wire();
}
}

View File

@ -125,6 +125,7 @@ import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.github.chrisbanes.photoview.PhotoView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import org.jsoup.nodes.Document;
@ -876,29 +877,31 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
// Line 2
tvSubject.setText(message.subject);
SpannableStringBuilder keywords = new SpannableStringBuilder();
for (String keyword : message.keywords) {
String k = keyword.toLowerCase();
if (IMAP_KEYWORDS_WHITELIST.contains(k) ||
!(k.startsWith("$") || IMAP_KEYWORDS_BLACKLIST.contains(k))) {
if (keywords.length() > 0)
keywords.append(", ");
keywords.append(keyword);
if (keywords_header) {
SpannableStringBuilder keywords = new SpannableStringBuilder();
for (int i = 0; i < message.keywords.length; i++) {
String k = message.keywords[i].toLowerCase();
if (IMAP_KEYWORDS_WHITELIST.contains(k) ||
!(k.startsWith("$") || IMAP_KEYWORDS_BLACKLIST.contains(k))) {
if (keywords.length() > 0)
keywords.append(", ");
String key = "keyword." + keyword;
if (prefs.contains(key)) {
int len = keywords.length();
int color = prefs.getInt(key, textColorSecondary);
keywords.setSpan(
new ForegroundColorSpan(color),
len - keyword.length(), len,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
keywords.append(message.keywords[i]);
if (message.keyword_colors[i] != null) {
int len = keywords.length();
keywords.setSpan(
new ForegroundColorSpan(message.keyword_colors[i]),
len - message.keywords[i].length(), len,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
}
}
tvKeywords.setVisibility(keywords_header && keywords.length() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setText(keywords);
tvKeywords.setVisibility(keywords.length() > 0 ? View.VISIBLE : View.GONE);
tvKeywords.setText(keywords);
} else
tvKeywords.setVisibility(View.GONE);
// Line 3
int icon = (message.drafts > 0
@ -3584,38 +3587,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onMenuManageKeywords(TupleMessageEx message) {
Bundle args = new Bundle();
args.putLong("id", message.id);
args.putStringArray("keywords", message.keywords);
new SimpleTask<EntityFolder>() {
@Override
protected EntityFolder onExecute(Context context, Bundle args) {
long id = args.getLong("id");
DB db = DB.getInstance(context);
EntityMessage message = db.message().getMessage(id);
if (message == null)
return null;
return db.folder().getFolder(message.folder);
}
@Override
protected void onExecuted(final Bundle args, EntityFolder folder) {
if (folder == null)
return;
args.putStringArray("fkeywords", folder.keywords);
FragmentKeywordManage fragment = new FragmentKeywordManage();
fragment.setArguments(args);
fragment.show(parentFragment.getParentFragmentManager(), "keyword:manage");
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(parentFragment.getParentFragmentManager(), ex);
}
}.execute(context, owner, args, "message:keywords");
FragmentDialogKeywordManage fragment = new FragmentDialogKeywordManage();
fragment.setArguments(args);
fragment.show(parentFragment.getParentFragmentManager(), "keyword:manage");
}
private void onMenuShare(TupleMessageEx message) {
@ -4163,6 +4138,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
void submitList(PagedList<TupleMessageEx> list) {
keyPosition.clear();
for (int i = 0; i < list.size(); i++) {
TupleMessageEx message = list.get(i);
if (message != null)
message.resolveKeywordColors(context);
}
differ.submitList(list);
}
@ -4516,6 +4496,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
same = false;
Log.i("duplicate changed id=" + next.id);
}
if (!Arrays.equals(prev.keyword_colors, next.keyword_colors)) {
same = false;
Log.i("keyword colors changed id=" + next.id);
}
return same;
}
@ -4933,110 +4917,66 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
}
}
public static class FragmentKeywordManage extends FragmentDialogBase {
public static class FragmentDialogKeywordManage extends FragmentDialogBase {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final long id = getArguments().getLong("id");
List<String> keywords = Arrays.asList(getArguments().getStringArray("keywords"));
List<String> fkeywords = Arrays.asList(getArguments().getStringArray("fkeywords"));
final List<String> items = new ArrayList<>(keywords);
for (String keyword : fkeywords)
if (!items.contains(keyword))
items.add(keyword);
final View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_keyword_manage, null);
final RecyclerView rvKeyword = dview.findViewById(R.id.rvKeyword);
final TextView tvPro = dview.findViewById(R.id.tvPro);
final FloatingActionButton fabAdd = dview.findViewById(R.id.fabAdd);
final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait);
Collections.sort(items);
rvKeyword.setHasFixedSize(false);
final LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvKeyword.setLayoutManager(llm);
final boolean[] selected = new boolean[items.size()];
final boolean[] dirty = new boolean[items.size()];
for (int i = 0; i < selected.length; i++) {
selected[i] = keywords.contains(items.get(i));
dirty[i] = false;
}
final AdapterKeyword adapter = new AdapterKeyword(getContext(), getViewLifecycleOwner());
rvKeyword.setAdapter(adapter);
Helper.linkPro(tvPro);
fabAdd.setEnabled(ActivityBilling.isPro(getContext()));
fabAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putLong("id", id);
FragmentDialogKeywordAdd fragment = new FragmentDialogKeywordAdd();
fragment.setArguments(args);
fragment.show(getParentFragmentManager(), "keyword:add");
}
});
pbWait.setVisibility(View.VISIBLE);
DB db = DB.getInstance(getContext());
db.message().liveMessageKeywords(id).observe(getViewLifecycleOwner(), new Observer<TupleKeyword.Persisted>() {
@Override
public void onChanged(TupleKeyword.Persisted data) {
pbWait.setVisibility(View.GONE);
adapter.set(id, TupleKeyword.from(getContext(), data));
}
});
return new AlertDialog.Builder(getContext())
.setTitle(R.string.title_manage_keywords)
.setMultiChoiceItems(items.toArray(new String[0]), selected, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
dirty[which] = true;
}
})
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (!ActivityBilling.isPro(getContext())) {
startActivity(new Intent(getContext(), ActivityBilling.class));
return;
}
Bundle args = new Bundle();
args.putLong("id", id);
args.putStringArray("keywords", items.toArray(new String[0]));
args.putBooleanArray("selected", selected);
args.putBooleanArray("dirty", dirty);
new SimpleTask<Void>() {
@Override
protected Void onExecute(Context context, Bundle args) {
long id = args.getLong("id");
String[] keywords = args.getStringArray("keywords");
boolean[] selected = args.getBooleanArray("selected");
boolean[] dirty = args.getBooleanArray("dirty");
DB db = DB.getInstance(context);
try {
db.beginTransaction();
EntityMessage message = db.message().getMessage(id);
if (message == null)
return null;
for (int i = 0; i < selected.length; i++)
if (dirty[i])
EntityOperation.queue(context, message, EntityOperation.KEYWORD, keywords[i], selected[i]);
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
ServiceSynchronize.eval(context, "keywords");
return null;
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), args, "message:keywords:manage");
}
})
.setNeutralButton(R.string.title_add, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Bundle args = new Bundle();
args.putLong("id", id);
FragmentKeywordAdd fragment = new FragmentKeywordAdd();
fragment.setArguments(args);
fragment.show(getParentFragmentManager(), "keyword:add");
}
})
.setView(dview)
.setNegativeButton(android.R.string.cancel, null)
.create();
}
}
public static class FragmentKeywordAdd extends FragmentDialogBase {
public static class FragmentDialogKeywordAdd extends FragmentDialogBase {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
final long id = getArguments().getLong("id");
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_keyword, null);
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_keyword_add, null);
final EditText etKeyword = view.findViewById(R.id.etKeyword);
etKeyword.setText(null);
@ -5045,11 +4985,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (!ActivityBilling.isPro(getContext())) {
startActivity(new Intent(getContext(), ActivityBilling.class));
return;
}
String keyword = MessageHelper.sanitizeKeyword(etKeyword.getText().toString());
if (!TextUtils.isEmpty(keyword)) {
Bundle args = new Bundle();
@ -5086,7 +5021,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getParentFragmentManager(), ex);
}
}.execute(getContext(), getActivity(), args, "message:keyword:add");
}.execute(getContext(), getActivity(), args, "keyword:add");
}
}
})

View File

@ -27,7 +27,6 @@ import android.app.NotificationManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.webkit.CookieManager;
import androidx.lifecycle.Observer;
@ -238,9 +237,6 @@ public class ApplicationEx extends Application {
editor.remove("folder_sync");
}
if (BuildConfig.DEBUG)
editor.putInt("keyword." + "$Phishing", Color.parseColor("#FFA500"));
if (version < BuildConfig.VERSION_CODE)
editor.putInt("previous_version", version);
editor.putInt("version", BuildConfig.VERSION_CODE);

View File

@ -315,6 +315,12 @@ public interface DaoMessage {
" WHERE message.id = :id")
LiveData<TupleMessageEx> liveMessage(long id);
@Query("SELECT message.keywords AS selected, folder.keywords AS available" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE message.id = :id")
LiveData<TupleKeyword.Persisted> liveMessageKeywords(long id);
@Transaction
@Query("SELECT account.id AS account, COUNT(message.id) AS unseen, SUM(ABS(notifying)) AS notifying" +
" FROM message" +

View File

@ -0,0 +1,86 @@
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.Context;
import android.content.SharedPreferences;
import androidx.annotation.Nullable;
import androidx.preference.PreferenceManager;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class TupleKeyword {
public String name;
public boolean selected;
public Integer color;
@Override
public boolean equals(@Nullable Object obj) {
if (obj instanceof TupleKeyword) {
TupleKeyword other = (TupleKeyword) obj;
return (this.name.equals(other.name) &&
this.selected == other.selected &&
Objects.equals(this.color, other.color));
} else
return false;
}
public static class Persisted {
public String[] selected;
public String[] available;
}
static List<TupleKeyword> from(Context context, Persisted data) {
List<TupleKeyword> result = new ArrayList<>();
List<String> keywords = new ArrayList<>();
for (String keyword : data.selected)
if (!keywords.contains(keyword))
keywords.add(keyword);
for (String keyword : data.available)
if (!keywords.contains(keyword))
keywords.add(keyword);
Collections.sort(keywords);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
for (String keyword : keywords) {
TupleKeyword k = new TupleKeyword();
k.name = keyword;
k.selected = Arrays.asList(data.selected).contains(keyword);
String c = "keyword." + keyword;
if (prefs.contains(c))
k.color = prefs.getInt(c, -1);
result.add(k);
}
return result;
}
}

View File

@ -20,9 +20,14 @@ package eu.faircode.email;
*/
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import androidx.preference.PreferenceManager;
import androidx.room.Ignore;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.mail.Address;
@ -53,12 +58,31 @@ public class TupleMessageEx extends EntityMessage {
@Ignore
boolean duplicate;
@Ignore
public Integer[] keyword_colors;
String getFolderName(Context context) {
return (folderDisplay == null
? Helper.localizeFolderName(context, folderName)
: folderDisplay);
}
void resolveKeywordColors(Context context) {
List<Integer> color = new ArrayList<>();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
for (int i = 0; i < this.keywords.length; i++) {
String key = "keyword." + this.keywords[i];
if (prefs.contains(key))
color.add(prefs.getInt(key, Color.GRAY));
else
color.add(null);
}
this.keyword_colors = color.toArray(new Integer[0]);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TupleMessageEx) {

View File

@ -21,7 +21,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:imeOptions="actionDone"
android:inputType="text"
android:inputType="textCapSentences"
android:text="Keyword"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvKeyword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:clipToPadding="false"
android:paddingBottom="60dp"
android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="@drawable/scroll_thumb_dialog"
android:scrollbars="vertical"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toTopOf="@+id/tvPro"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvPro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_pro_feature"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorLink"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rvKeyword" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:contentDescription="@string/title_add"
android:tint="?attr/colorFabForeground"
app:backgroundTint="?attr/colorFabBackground"
app:fabSize="mini"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/baseline_add_24" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWait"
style="@style/Base.Widget.AppCompat.ProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
android:padding="24dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/activatableItemBackground"
android:padding="6dp">
<CheckBox
android:id="@+id/cbKeyword"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Keyword"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="@+id/btnColor"
app:layout_constraintEnd_toStartOf="@+id/btnColor"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/btnColor" />
<eu.faircode.email.ViewButtonColor
android:id="@+id/btnColor"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="0dp"
android:minHeight="0dp"
android:padding="9dp"
android:text="@string/title_select"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/cbKeyword"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>