Add hyperlink to style toolbar

This commit is contained in:
M66B 2022-12-13 20:02:14 +01:00
parent 57e97835b4
commit b033bef96d
3 changed files with 28 additions and 1 deletions

View File

@ -264,6 +264,7 @@ public class FragmentCompose extends FragmentBase {
private View vwAnchor;
private TextViewAutoCompleteAction etSearch;
private HorizontalScrollView style_bar;
private ImageButton ibLink;
private BottomNavigationView media_bar;
private BottomNavigationView bottom_navigation;
private ContentLoadingProgressBar pbWait;
@ -395,6 +396,7 @@ public class FragmentCompose extends FragmentBase {
vwAnchor = view.findViewById(R.id.vwAnchor);
etSearch = view.findViewById(R.id.etSearch);
style_bar = view.findViewById(R.id.style_bar);
ibLink = view.findViewById(R.id.menu_link);
media_bar = view.findViewById(R.id.media_bar);
bottom_navigation = view.findViewById(R.id.bottom_navigation);
@ -885,6 +887,14 @@ public class FragmentCompose extends FragmentBase {
StyleHelper.wire(getViewLifecycleOwner(), view, etBody);
ibLink.setVisibility(View.VISIBLE);
ibLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onActionLink();
}
});
media_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {

View File

@ -139,6 +139,8 @@ public class StyleHelper {
else if (id == R.id.menu_style_code)
v.setVisibility(BuildConfig.DEBUG ? View.VISIBLE : View.GONE);
}
view.findViewById(R.id.menu_link).setVisibility(View.GONE);
}
static TextWatcher getTextWatcher(EditText etBody) {

View File

@ -59,6 +59,21 @@
app:srcCompat="@drawable/twotone_format_underlined_24"
app:tint="@color/action_foreground" />
<ImageButton
android:id="@+id/menu_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_style_link"
android:paddingHorizontal="12dp"
android:paddingVertical="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_style_link"
app:layout_constraintStart_toEndOf="@id/menu_underline"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_insert_link_45_24"
app:tint="@color/action_foreground" />
<ImageButton
android:id="@+id/menu_style_size"
android:layout_width="wrap_content"
@ -69,7 +84,7 @@
android:paddingVertical="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_style_size"
app:layout_constraintStart_toEndOf="@id/menu_underline"
app:layout_constraintStart_toEndOf="@id/menu_link"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/twotone_format_size_24"
app:tint="@color/action_foreground" />