Skip to content

Commit 9f4ace5

Browse files
authored
Restore audio action (PR #2481)
1 parent cc9518b commit 9f4ace5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

app/src/main/java/net/gsantner/markor/frontend/AttachLinkOrFileDialog.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import android.widget.Button;
1818
import android.widget.EditText;
1919
import android.widget.LinearLayout;
20+
import android.widget.Toast;
2021

2122
import androidx.annotation.Nullable;
2223
import androidx.appcompat.app.AlertDialog;
@@ -98,6 +99,7 @@ public static void showInsertImageOrLinkDialog(
9899
final Button buttonPictureGallery = view.findViewById(R.id.ui__select_path_dialog__gallery_picture);
99100
final Button buttonPictureCamera = view.findViewById(R.id.ui__select_path_dialog__camera_picture);
100101
final Button buttonPictureEdit = view.findViewById(R.id.ui__select_path_dialog__edit_picture);
102+
final Button buttonAudioRecord = view.findViewById(R.id.ui__select_path_dialog__record_audio);
101103

102104
// Extract filepath if using Markdown
103105
if (textFormatId == FormatRegistry.FORMAT_MARKDOWN) {
@@ -133,6 +135,11 @@ public static void showInsertImageOrLinkDialog(
133135
dialog.setTitle(R.string.insert_image);
134136
browseType = InsertType.IMAGE_BROWSE;
135137
okType = InsertType.IMAGE_DIALOG;
138+
} else if (action == AUDIO_ACTION) {
139+
dialog.setTitle(R.string.audio);
140+
buttonAudioRecord.setVisibility(View.VISIBLE);
141+
browseType = InsertType.AUDIO_BROWSE;
142+
okType = InsertType.AUDIO_DIALOG;
136143
} else {
137144
dialog.setTitle(R.string.insert_link);
138145
buttonSelectSpecial.setVisibility(View.VISIBLE);
@@ -148,6 +155,7 @@ public static void showInsertImageOrLinkDialog(
148155
buttonSearch.setOnClickListener(v -> _insertItem.callback(InsertType.LINK_SEARCH));
149156
buttonPictureCamera.setOnClickListener(b -> _insertItem.callback(InsertType.IMAGE_CAMERA));
150157
buttonPictureGallery.setOnClickListener(v -> _insertItem.callback(InsertType.IMAGE_GALLERY));
158+
buttonAudioRecord.setOnClickListener(v -> _insertItem.callback(InsertType.AUDIO_RECORDING));
151159
buttonPictureEdit.setOnClickListener(v -> _insertItem.callback(InsertType.IMAGE_EDIT));
152160

153161
dialog.show();
@@ -400,7 +408,7 @@ private static void insertItem(
400408
}
401409
case AUDIO_RECORDING: {
402410
if (!cu.requestAudioRecording(activity, insertFileLink)) {
403-
// noop, OM library is outdated and so voice recording feature removed
411+
Toast.makeText(activity, "❌", Toast.LENGTH_SHORT).show();
404412
}
405413
break;
406414
}

app/src/main/res/layout/select_path_dialog.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@
9393
android:drawableLeft="@drawable/ic_crop_black_24dp"
9494
android:visibility="gone"
9595
android:text="@string/edit_picture" />
96+
97+
<Button
98+
android:id="@+id/ui__select_path_dialog__record_audio"
99+
android:layout_width="match_parent"
100+
android:layout_height="wrap_content"
101+
android:drawableStart="@drawable/ic_keyboard_voice_black_24dp"
102+
android:drawableLeft="@drawable/ic_keyboard_voice_black_24dp"
103+
android:visibility="gone"
104+
android:text="@string/record_audio" />
96105
</LinearLayout>
97106

98107
</ScrollView>

0 commit comments

Comments
 (0)