mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 11:01:23 +01:00
Experiment: insert parenthesis
This commit is contained in:
@@ -198,6 +198,7 @@ public class StyleHelper {
|
||||
IndentSpan[] indents = edit.getSpans(start, end, IndentSpan.class);
|
||||
popupMenu.getMenu().findItem(R.id.menu_style_indentation_decrease).setEnabled(indents.length > 0);
|
||||
|
||||
popupMenu.getMenu().findItem(R.id.menu_style_parenthesis).setEnabled(BuildConfig.DEBUG);
|
||||
popupMenu.getMenu().findItem(R.id.menu_style_code).setEnabled(BuildConfig.DEBUG);
|
||||
|
||||
popupMenu.insertIcons(context);
|
||||
@@ -233,6 +234,8 @@ public class StyleHelper {
|
||||
return setMark(item);
|
||||
} else if (groupId == R.id.group_style_strikethrough) {
|
||||
return setStrikeThrough(item);
|
||||
} else if (groupId == R.id.group_style_parenthesis) {
|
||||
return setParenthesis(item);
|
||||
} else if (groupId == R.id.group_style_code) {
|
||||
return setCode(item);
|
||||
} else if (groupId == R.id.group_style_clear) {
|
||||
@@ -662,7 +665,15 @@ public class StyleHelper {
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setParenthesis(MenuItem item) {
|
||||
Log.breadcrumb("style", "action", "parenthesis");
|
||||
edit.insert(end, ")");
|
||||
edit.insert(start, "(");
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean setCode(MenuItem item) {
|
||||
Log.breadcrumb("style", "action", "code");
|
||||
_setSize(HtmlHelper.FONT_SMALL);
|
||||
_setFont("monospace");
|
||||
return true;
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
android:drawable="@drawable/twotone_attachment_24"
|
||||
android:maxLevel="0" />
|
||||
<item
|
||||
android:drawable="@drawable/baseline_code_24"
|
||||
android:drawable="@drawable/twotone_code_24"
|
||||
android:maxLevel="1" />
|
||||
</level-list>
|
||||
|
||||
13
app/src/main/res/drawable/twotone_data_object_24.xml
Normal file
13
app/src/main/res/drawable/twotone_data_object_24.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M4,7v2c0,0.55 -0.45,1 -1,1H2v4h1c0.55,0 1,0.45 1,1v2c0,1.65 1.35,3 3,3h3v-2H7c-0.55,0 -1,-0.45 -1,-1v-2c0,-1.3 -0.84,-2.42 -2,-2.83v-0.34C5.16,11.42 6,10.3 6,9V7c0,-0.55 0.45,-1 1,-1h3V4H7C5.35,4 4,5.35 4,7z"/>
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M21,10c-0.55,0 -1,-0.45 -1,-1V7c0,-1.65 -1.35,-3 -3,-3h-3v2h3c0.55,0 1,0.45 1,1v2c0,1.3 0.84,2.42 2,2.83v0.34c-1.16,0.41 -2,1.52 -2,2.83v2c0,0.55 -0.45,1 -1,1h-3v2h3c1.65,0 3,-1.35 3,-3v-2c0,-0.55 0.45,-1 1,-1h1v-4H21z"/>
|
||||
</vector>
|
||||
@@ -302,7 +302,7 @@
|
||||
android:padding="3dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tvStructure"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@drawable/baseline_code_24" />
|
||||
app:srcCompat="@drawable/twotone_code_24" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:drawableEnd="@drawable/baseline_code_24"
|
||||
android:drawableEnd="@drawable/twotone_code_24"
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/title_show_headers"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
|
||||
@@ -344,7 +344,7 @@
|
||||
android:padding="6dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:tooltipText="@string/title_show_headers"
|
||||
app:srcCompat="@drawable/baseline_code_24"
|
||||
app:srcCompat="@drawable/twotone_code_24"
|
||||
tools:ignore="MissingConstraints" />
|
||||
|
||||
<ImageButton
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
<item
|
||||
android:id="@+id/menu_show_headers"
|
||||
android:checkable="true"
|
||||
android:icon="@drawable/baseline_code_24"
|
||||
android:icon="@drawable/twotone_code_24"
|
||||
android:title="@string/title_show_headers" />
|
||||
|
||||
<item
|
||||
|
||||
@@ -151,12 +151,21 @@
|
||||
android:title="@string/title_style_strikethrough" />
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:id="@+id/group_style_parenthesis"
|
||||
android:orderInCategory="11">
|
||||
<item
|
||||
android:id="@+id/menu_style_parenthesis"
|
||||
android:icon="@drawable/twotone_data_object_24"
|
||||
android:title="@string/title_style_parenthesis" />
|
||||
</group>
|
||||
|
||||
<group
|
||||
android:id="@+id/group_style_code"
|
||||
android:orderInCategory="11">
|
||||
<item
|
||||
android:id="@+id/menu_style_code"
|
||||
android:icon="@drawable/baseline_code_24"
|
||||
android:icon="@drawable/twotone_code_24"
|
||||
android:title="@string/title_style_code" />
|
||||
</group>
|
||||
|
||||
|
||||
@@ -1394,6 +1394,7 @@
|
||||
<string name="title_style_indentation">Indentation</string>
|
||||
<string name="title_style_mark">Highlight</string>
|
||||
<string name="title_style_strikethrough">Strikethrough</string>
|
||||
<string name="title_style_parenthesis" translatable="false">Parenthesis</string>
|
||||
<string name="title_style_code" translatable="false">Code</string>
|
||||
<string name="title_style_clear">Clear formatting</string>
|
||||
<string name="title_style_link">Insert link</string>
|
||||
|
||||
Reference in New Issue
Block a user