mirror of https://github.com/M66B/FairEmail.git
Insert template from style toolbar
This commit is contained in:
parent
f3bb9f26a7
commit
ee38ecc69a
|
@ -265,6 +265,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
private TextViewAutoCompleteAction etSearch;
|
||||
private HorizontalScrollView style_bar;
|
||||
private ImageButton ibLink;
|
||||
private ImageButton ibAnswer;
|
||||
private BottomNavigationView media_bar;
|
||||
private BottomNavigationView bottom_navigation;
|
||||
private ContentLoadingProgressBar pbWait;
|
||||
|
@ -397,6 +398,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
etSearch = view.findViewById(R.id.etSearch);
|
||||
style_bar = view.findViewById(R.id.style_bar);
|
||||
ibLink = view.findViewById(R.id.menu_link);
|
||||
ibAnswer = view.findViewById(R.id.menu_style_insert_answer);
|
||||
media_bar = view.findViewById(R.id.media_bar);
|
||||
bottom_navigation = view.findViewById(R.id.bottom_navigation);
|
||||
|
||||
|
@ -897,6 +899,14 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
});
|
||||
|
||||
ibAnswer.setVisibility(View.VISIBLE);
|
||||
ibAnswer.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onMenuAnswerInsert(v);
|
||||
}
|
||||
});
|
||||
|
||||
media_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
|
@ -1920,7 +1930,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
onMenuManageLocalContacts();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_answer_insert) {
|
||||
onMenuAnswerInsert();
|
||||
onMenuAnswerInsert(vwAnchorMenu);
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_answer_create) {
|
||||
onMenuAnswerCreate();
|
||||
|
@ -2148,7 +2158,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
fragment.show(getParentFragmentManager(), "compose:groups");
|
||||
}
|
||||
|
||||
private void onMenuAnswerInsert() {
|
||||
private void onMenuAnswerInsert(View anchor) {
|
||||
new SimpleTask<List<EntityAnswer>>() {
|
||||
@Override
|
||||
protected List<EntityAnswer> onExecute(Context context, Bundle args) {
|
||||
|
@ -2165,7 +2175,7 @@ public class FragmentCompose extends FragmentBase {
|
|||
return;
|
||||
}
|
||||
|
||||
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), vwAnchorMenu);
|
||||
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), anchor);
|
||||
EntityAnswer.fillMenu(popupMenu.getMenu(), true, answers, context);
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
|
|
|
@ -108,6 +108,7 @@ public class StyleHelper {
|
|||
R.id.menu_style_superscript,
|
||||
R.id.menu_style_strikethrough,
|
||||
R.id.menu_style_insert_line,
|
||||
R.id.menu_style_insert_answer,
|
||||
R.id.menu_style_spell_check,
|
||||
R.id.menu_style_password,
|
||||
R.id.menu_style_code,
|
||||
|
@ -134,7 +135,9 @@ public class StyleHelper {
|
|||
|
||||
v.setOnClickListener(styleListener);
|
||||
|
||||
if (id == R.id.menu_style_spell_check)
|
||||
if (id == R.id.menu_style_insert_answer)
|
||||
v.setVisibility(View.GONE);
|
||||
else if (id == R.id.menu_style_spell_check)
|
||||
v.setVisibility(
|
||||
BuildConfig.DEBUG && LanguageTool.isEnabled(v.getContext())
|
||||
? View.VISIBLE : View.GONE);
|
||||
|
@ -398,7 +401,8 @@ public class StyleHelper {
|
|||
itemId != R.id.menu_style_list && groupId != group_style_list &&
|
||||
itemId != R.id.menu_style_indentation && groupId != group_style_indentation &&
|
||||
itemId != R.id.menu_style_blockquote &&
|
||||
itemId != R.id.menu_style_insert_line) {
|
||||
itemId != R.id.menu_style_insert_line &&
|
||||
itemId != R.id.menu_style_insert_answer) {
|
||||
Pair<Integer, Integer> word = getWord(etBody);
|
||||
if (word == null)
|
||||
return false;
|
||||
|
|
|
@ -269,6 +269,21 @@
|
|||
app:srcCompat="@drawable/twotone_horizontal_rule_24"
|
||||
app:tint="@color/action_foreground" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/menu_style_insert_answer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/menu_answers"
|
||||
android:paddingHorizontal="12dp"
|
||||
android:paddingVertical="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:tooltipText="@string/menu_answers"
|
||||
app:layout_constraintStart_toEndOf="@id/menu_style_insert_line"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/twotone_text_snippet_24"
|
||||
app:tint="@color/action_foreground" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/menu_style_spell_check"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -279,7 +294,7 @@
|
|||
android:paddingVertical="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:tooltipText="@string/title_advanced_lt"
|
||||
app:layout_constraintStart_toEndOf="@id/menu_style_insert_line"
|
||||
app:layout_constraintStart_toEndOf="@id/menu_style_insert_answer"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/twotone_spellcheck_24"
|
||||
app:tint="@color/action_foreground" />
|
||||
|
@ -328,6 +343,5 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/twotone_format_clear_24"
|
||||
app:tint="@color/action_foreground" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</HorizontalScrollView>
|
||||
|
|
Loading…
Reference in New Issue