-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When the audio recorder is on the reviewer we want a single mode which includes playback without pausing This removes the 'save' button and associated state record -> stop -> playback -> cancel ==== icons were added for: * play * stop The record button was made slightly smaller to be consistent with this icon set Issue 16185
- Loading branch information
1 parent
0a62992
commit 8a72fe5
Showing
9 changed files
with
467 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
218 changes: 176 additions & 42 deletions
218
AnkiDroid/src/main/java/com/ichi2/audio/AudioRecordingController.kt
Large diffs are not rendered by default.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
AnkiDroid/src/main/res/drawable/bg_rounded_drop_shadow.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
~ Copyright (c) 2024 David Allison <davidallisongithub@gmail.com> | ||
~ | ||
~ This program 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. | ||
~ | ||
~ This program 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 | ||
~ this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<!-- | ||
Drop shadow - Android tips & tricks - anonymous contributor | ||
https://stackoverflow.com/a/24095309/ | ||
--> | ||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="#CABBBBBB"/> | ||
<corners android:radius="16dp" /> | ||
</shape> | ||
</item> | ||
|
||
<item | ||
android:left="0dp" | ||
android:right="1dp" | ||
android:top="0dp" | ||
android:bottom="1dp"> | ||
<shape android:shape="rectangle"> | ||
<solid android:color="?android:attr/colorBackground"/> | ||
<corners android:radius="16dp" /> | ||
<stroke android:color="#CABBBBBB" android:width="1dp" /> | ||
</shape> | ||
</item> | ||
</layer-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M8,5v14l11,-7z"/> | ||
|
||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<vector android:height="24dp" android:tint="#000000" | ||
android:viewportHeight="24" android:viewportWidth="24" | ||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<path android:fillColor="@android:color/white" android:pathData="M12,12m-8,0a8,8 0,1 1,16 0a8,8 0,1 1,-16 0"/> | ||
<path android:fillColor="@android:color/white" android:pathData="M12,12m-7,0a7,7 0,1 1,14 0a7,7 0,1 1,-14 0"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24" | ||
android:tint="#000000"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#000000" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp"> | ||
|
||
<path android:fillColor="@android:color/white" android:pathData="M8,6h8c1.1,0 2,0.9 2,2v8c0,1.1 -0.9,2 -2,2H8c-1.1,0 -2,-0.9 -2,-2V8c0,-1.1 0.9,-2 2,-2z"/> | ||
|
||
</vector> |
222 changes: 222 additions & 0 deletions
222
AnkiDroid/src/main/res/layout/activity_audio_recording_reviewer.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
~ Copyright (c) 2023 Ashish Yadav <mailtoashish693@gmail.com> | ||
~ Copyright (c) 2024 David Allison <davidallisongithub@gmail.com> | ||
~ | ||
~ This program 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. | ||
~ | ||
~ This program 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 | ||
~ this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
<LinearLayout android:id="@+id/audioView" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:orientation="vertical" | ||
android:keepScreenOn="true" | ||
tools:context="com.ichi2.audio.AudioRecordingController"> | ||
|
||
<RelativeLayout | ||
android:id="@+id/record_buttons_layout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center" | ||
android:layout_marginTop="12dp" | ||
android:layout_marginBottom="8dp" | ||
android:layout_marginHorizontal="16dp" | ||
android:background="@drawable/bg_rounded_drop_shadow" | ||
android:orientation="horizontal"> | ||
|
||
<com.ichi2.audio.AudioWaveform | ||
android:id="@+id/audio_waveform_view" | ||
android:layout_height="40dp" | ||
android:layout_width="match_parent" | ||
android:layout_alignParentStart="true" | ||
android:layout_toStartOf="@+id/action_start_recording" | ||
android:layout_centerVertical="true" | ||
android:layout_marginStart="14dp" | ||
android:paddingVertical="6dp" | ||
android:background="?android:attr/colorBackground" | ||
app:display_vertical_line="false" /> | ||
|
||
<com.google.android.material.progressindicator.LinearProgressIndicator | ||
android:id="@+id/audio_progress_indicator" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="12dp" | ||
android:layout_marginStart="14dp" | ||
android:layout_centerVertical="true" | ||
android:foregroundGravity="center" | ||
|
||
android:layout_toStartOf="@+id/action_start_recording" | ||
|
||
android:progress="0" | ||
|
||
app:indicatorColor="@color/material_blue_500" | ||
app:trackColor="@color/material_light_blue_100" | ||
android:visibility="gone" | ||
/> | ||
|
||
<!-- TODO: Icons are centered manually on the next two buttons--> | ||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_start_recording" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
|
||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
android:layout_gravity="center" | ||
android:layout_centerVertical="true" | ||
android:layout_toStartOf="@+id/action_cancel_recording" | ||
|
||
android:layout_marginStart="2dp" | ||
android:clickable="true" | ||
android:focusable="true" | ||
|
||
android:insetBottom="6dp" | ||
android:insetLeft="6dp" | ||
android:insetRight="6dp" | ||
android:insetTop="6dp" | ||
|
||
android:paddingStart="10dp" | ||
|
||
app:backgroundTint="@color/material_grey_100" | ||
app:icon="@drawable/ic_record" | ||
app:iconGravity="textStart" | ||
app:iconSize="24dp" | ||
app:iconTint="@color/flag_red" | ||
app:strokeColor="@color/flag_red" | ||
app:strokeWidth="2dp" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_cancel_recording" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
|
||
android:layout_alignParentEnd="true" | ||
|
||
android:insetBottom="0dp" | ||
android:insetLeft="0dp" | ||
android:insetRight="0dp" | ||
android:insetTop="0dp" | ||
|
||
android:paddingStart="11dp" | ||
|
||
app:backgroundTint="@color/transparent" | ||
app:icon="@drawable/ic_clear_white" | ||
app:iconTint="?attr/editTextColor" | ||
app:iconSize="24dp" | ||
/> | ||
|
||
</RelativeLayout> | ||
|
||
<LinearLayout | ||
android:visibility="gone" | ||
android:id="@+id/play_buttons_layout" | ||
android:layout_width="match_parent" | ||
android:orientation="vertical" | ||
android:layout_height="match_parent"> | ||
|
||
<com.google.android.material.imageview.ShapeableImageView | ||
android:id="@+id/audio_file_imageview" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="2dp" | ||
android:minHeight="300px" | ||
android:paddingVertical="6dp" | ||
android:src="@drawable/round_audio_file_24" | ||
android:tint="@color/material_blue_500" /> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginVertical="8dp" | ||
android:gravity="center" | ||
android:orientation="horizontal" | ||
android:visibility="visible"> | ||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_rewind" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="6dp" | ||
android:clickable="true" | ||
android:focusable="true" | ||
android:enabled="false" | ||
app:backgroundTint="@color/material_blue_500" | ||
app:icon="@drawable/baseline_replay_5_24" | ||
app:iconPadding="0dp" | ||
app:iconSize="22dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/action_play_recording" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_play_recording" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="10dp" | ||
android:clickable="true" | ||
android:focusable="true" | ||
android:padding="10dp" | ||
app:backgroundTint="@color/material_grey_100" | ||
app:icon="@drawable/round_play_arrow_24" | ||
app:iconPadding="0dp" | ||
app:iconSize="50dp" | ||
app:iconTint="@color/flag_red" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:strokeColor="@color/flag_red" | ||
app:strokeWidth="4dp" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_forward" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="6dp" | ||
android:clickable="true" | ||
android:focusable="true" | ||
android:enabled="false" | ||
app:backgroundTint="@color/material_blue_500" | ||
app:icon="@drawable/baseline_forward_5_24" | ||
app:iconPadding="0dp" | ||
app:iconSize="22dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/action_play_recording" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/action_discard_recording" | ||
style="@style/Widget.Material3.Button.IconButton.Filled" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginHorizontal="6dp" | ||
app:backgroundTint="@color/material_blue_500" | ||
app:icon="@drawable/ic_delete" | ||
app:iconPadding="0dp" | ||
app:iconSize="22dp" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/action_forward" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
</LinearLayout> | ||
|
||
<com.google.android.material.divider.MaterialDivider | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:dividerThickness="2dp" /> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters