Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
My notepad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731301
My notepad
Commits
6ed5866a
Commit
6ed5866a
authored
Oct 03, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change the recorder structure to fragments and add animations
parent
b9db25b6
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
737 additions
and
485 deletions
+737
-485
build.gradle
app/build.gradle
+7
-0
AudioListFragment.java
...notepad/MenuFeatures/VoiceMassages/AudioListFragment.java
+156
-0
RecordFragment.java
.../mynotepad/MenuFeatures/VoiceMassages/RecordFragment.java
+159
-0
RecorderActivity.java
...ynotepad/MenuFeatures/VoiceMassages/RecorderActivity.java
+0
-296
VoiceMassagesActivity.java
...pad/MenuFeatures/VoiceMassages/VoiceMassagesActivity.java
+1
-118
TimeAgo.java
...ures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
+17
-0
fade_in.xml
app/src/main/res/anim/fade_in.xml
+16
-0
fade_out.xml
app/src/main/res/anim/fade_out.xml
+16
-0
slide_in.xml
app/src/main/res/anim/slide_in.xml
+9
-0
slide_out.xml
app/src/main/res/anim/slide_out.xml
+8
-0
media_header_bg.xml
app/src/main/res/drawable/media_header_bg.xml
+12
-0
mic.xml
app/src/main/res/drawable/mic.xml
+10
-0
music.xml
app/src/main/res/drawable/music.xml
+5
-0
player_bg.xml
app/src/main/res/drawable/player_bg.xml
+9
-0
white_play_arrow.xml
app/src/main/res/drawable/white_play_arrow.xml
+5
-0
activity_voice_massages.xml
app/src/main/res/layout/activity_voice_massages.xml
+6
-63
custom_voice_item.xml
app/src/main/res/layout/custom_voice_item.xml
+16
-4
fragment_audio_list.xml
app/src/main/res/layout/fragment_audio_list.xml
+52
-0
fragment_record.xml
app/src/main/res/layout/fragment_record.xml
+66
-0
player_sheet.xml
app/src/main/res/layout/player_sheet.xml
+132
-0
nav_graph.xml
app/src/main/res/navigation/nav_graph.xml
+28
-0
colors.xml
app/src/main/res/values/colors.xml
+3
-3
strings.xml
app/src/main/res/values/strings.xml
+3
-0
styles.xml
app/src/main/res/values/styles.xml
+1
-1
No files found.
app/build.gradle
View file @
6ed5866a
...
...
@@ -39,4 +39,11 @@ dependencies {
implementation
"androidx.room:room-runtime:$room_version"
annotationProcessor
"androidx.room:room-compiler:$room_version"
//i added these parts just for voice recorder
def
nav_version
=
"2.3.0"
implementation
"androidx.navigation:navigation-fragment:$nav_version"
implementation
"androidx.navigation:navigation-ui:$nav_version"
implementation
'com.google.android.material:material:1.3.0-alpha03'
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/AudioListFragment.java
0 → 100644
View file @
6ed5866a
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
;
import
android.app.AlertDialog
;
import
android.content.DialogInterface
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.fragment.app.Fragment
;
import
androidx.recyclerview.widget.LinearLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener
;
import
com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.MyVoice
;
import
com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.OnVoiceMassageClickListener
;
import
com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.VoiceAdaptor
;
import
com.example.mynotepad.R
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.floatingactionbutton.FloatingActionButton
;
import
java.io.File
;
import
java.util.ArrayList
;
public
class
AudioListFragment
extends
Fragment
{
private
ConstraintLayout
playerSheet
;
private
BottomSheetBehavior
bottomSheetBehavior
;
private
RecyclerView
recyclerViewRecordings
;
private
VoiceAdaptor
recordingAdapter
;
private
ArrayList
<
MyVoice
>
myVoiceArrayList
;
private
CustomToolbarOption
customToolbarOption
;
private
MyVoice
myChosenVoice
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
return
inflater
.
inflate
(
R
.
layout
.
fragment_audio_list
,
container
,
false
);
}
@Override
public
void
onViewCreated
(
@NonNull
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
init
(
view
);
fetchRecordings
();
addListener
();
}
private
void
init
(
View
v
)
{
playerSheet
=
v
.
findViewById
(
R
.
id
.
player_sheet
);
bottomSheetBehavior
=
BottomSheetBehavior
.
from
(
playerSheet
);
setBottomSheet
();
customToolbarOption
=
v
.
findViewById
(
R
.
id
.
customToolbarOption
);
customToolbarOption
.
setVisibility
(
View
.
GONE
);
myVoiceArrayList
=
new
ArrayList
<>();
recyclerViewRecordings
=
v
.
findViewById
(
R
.
id
.
recyclerView
);
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerViewRecordings
.
setHasFixedSize
(
true
);
}
private
void
fetchRecordings
()
{
File
root
=
android
.
os
.
Environment
.
getExternalStorageDirectory
();
String
path
=
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios"
;
Log
.
d
(
"Files"
,
"Path: "
+
path
);
File
directory
=
new
File
(
path
);
File
[]
files
=
directory
.
listFiles
();
if
(
files
!=
null
)
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
String
fileName
=
files
[
i
].
getName
();
String
recordingUri
=
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios/"
+
fileName
;
MyVoice
myVoice
=
new
MyVoice
(
recordingUri
,
fileName
,
false
);
myVoiceArrayList
.
add
(
myVoice
);
}
}
recordingAdapter
=
new
VoiceAdaptor
(
getContext
(),
myVoiceArrayList
);
recyclerViewRecordings
.
setAdapter
(
recordingAdapter
);
}
private
void
setBottomSheet
()
{
bottomSheetBehavior
.
addBottomSheetCallback
(
new
BottomSheetBehavior
.
BottomSheetCallback
()
{
@Override
public
void
onStateChanged
(
@NonNull
View
bottomSheet
,
int
newState
)
{
if
(
newState
==
BottomSheetBehavior
.
STATE_HIDDEN
){
//if it goes to the bottom of the screen
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
// in the first position that it used to be
}
}
@Override
public
void
onSlide
(
@NonNull
View
bottomSheet
,
float
slideOffset
)
{
}
});
}
private
void
addListener
()
{
recordingAdapter
.
setOnVoiceMassageClickListener
(
new
OnVoiceMassageClickListener
()
{
@Override
public
void
onItemLongClicked
(
MyVoice
item
)
{
customToolbarOption
.
setVisibility
(
View
.
VISIBLE
);
customToolbarOption
.
hideStar
();
myChosenVoice
=
item
;
}
});
//add listener to custom toolbar option and set being archived or not to be saved in database
customToolbarOption
.
setCustomToolbarOptionListener
(
new
CustomToolbarOptionListener
()
{
@Override
public
void
onStarClicked
()
{
}
@Override
public
void
onDeleteClicked
()
{
deleteClicked
();
}
@Override
public
void
onCloseClicked
()
{
customToolbarOption
.
setVisibility
(
View
.
GONE
);
}
});
}
private
void
deleteClicked
()
{
AlertDialog
.
Builder
alert
=
new
AlertDialog
.
Builder
(
getContext
());
alert
.
setMessage
(
"are you sure you wanna delete it ??? "
);
alert
.
setPositiveButton
(
"yes"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
myVoiceArrayList
.
remove
(
myChosenVoice
);
System
.
out
.
println
(
myChosenVoice
.
getFileName
()
+
" "
+
myChosenVoice
.
getUri
()
);
new
File
(
myChosenVoice
.
getFileName
()).
delete
();
customToolbarOption
.
setVisibility
(
View
.
GONE
);
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerViewRecordings
.
setHasFixedSize
(
true
);
}
});
alert
.
setNegativeButton
(
"no"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialogInterface
.
cancel
();
}
});
alert
.
show
();
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/RecordFragment.java
0 → 100644
View file @
6ed5866a
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.content.pm.PackageManager
;
import
android.media.MediaRecorder
;
import
android.os.Build
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.RequiresApi
;
import
androidx.core.content.ContextCompat
;
import
androidx.fragment.app.Fragment
;
import
androidx.navigation.NavController
;
import
androidx.navigation.Navigation
;
import
android.os.SystemClock
;
import
android.transition.TransitionManager
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Chronometer
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.Toast
;
import
com.example.mynotepad.R
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
public
class
RecordFragment
extends
Fragment
implements
View
.
OnClickListener
{
private
NavController
navController
;
private
ImageView
listBtn
;
private
ImageButton
recordBtn
;
private
boolean
isRecording
=
false
;
private
MediaRecorder
mRecorder
;
private
String
fileName
=
null
;
private
Chronometer
chronometer
;
private
int
RECORD_AUDIO_REQUEST_CODE
=
123
;
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
// Inflate the layout for this fragment
return
inflater
.
inflate
(
R
.
layout
.
fragment_record
,
container
,
false
);
}
@Override
public
void
onViewCreated
(
@NonNull
View
view
,
@Nullable
Bundle
savedInstanceState
)
{
super
.
onViewCreated
(
view
,
savedInstanceState
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
getPermissionToRecordAudio
();
}
init
(
view
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
public
void
getPermissionToRecordAudio
()
{
if
(
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
RECORD_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
getContext
(),
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
RECORD_AUDIO
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
RECORD_AUDIO_REQUEST_CODE
);
}
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
permissions
[],
int
[]
grantResults
)
{
if
(
requestCode
==
RECORD_AUDIO_REQUEST_CODE
)
{
if
(
grantResults
.
length
==
3
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
&&
grantResults
[
1
]
==
PackageManager
.
PERMISSION_GRANTED
&&
grantResults
[
2
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
Toast
.
makeText
(
getContext
(),
"accepted"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
getContext
(),
"You must give permissions to use this app. App is exiting."
,
Toast
.
LENGTH_SHORT
).
show
();
getActivity
().
finish
();
}
}
}
private
void
init
(
View
view
)
{
navController
=
Navigation
.
findNavController
(
view
);
listBtn
=
view
.
findViewById
(
R
.
id
.
recordList
);
recordBtn
=
view
.
findViewById
(
R
.
id
.
recordBtn
);
chronometer
=
view
.
findViewById
(
R
.
id
.
chronometerTimer
);
listBtn
.
setOnClickListener
(
this
);
recordBtn
.
setOnClickListener
(
this
);
}
@SuppressLint
(
"UseCompatLoadingForDrawables"
)
@Override
public
void
onClick
(
View
view
)
{
switch
(
view
.
getId
())
{
case
R
.
id
.
recordList
:
{
navController
.
navigate
(
R
.
id
.
action_recordFragment_to_audioListFragment
);
break
;
}
case
R
.
id
.
recordBtn
:
{
if
(
isRecording
)
{
//stop recording
isRecording
=
false
;
recordBtn
.
setBackground
(
getResources
().
getDrawable
(
R
.
drawable
.
start_stop_bg
));
stopRecording
();
}
else
{
//start recording
isRecording
=
true
;
recordBtn
.
setBackground
(
getResources
().
getDrawable
(
R
.
drawable
.
stop_btn_bg
));
startRecording
();
}
break
;
}
}
}
private
void
startRecording
()
{
File
root
=
android
.
os
.
Environment
.
getExternalStorageDirectory
();
File
file
=
new
File
(
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios"
);
//create a 2 folders inside each other to save voices
if
(!
file
.
exists
())
{
file
.
mkdirs
();
//create a the folders if it does not exists
}
fileName
=
new
SimpleDateFormat
(
"yyyy_MM_dd_hh_mm_ss"
,
Locale
.
CANADA
).
format
(
new
Date
())
+
".mp3"
;
Log
.
d
(
"filename"
,
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios/"
+
fileName
);
mRecorder
=
new
MediaRecorder
();
mRecorder
.
setAudioSource
(
MediaRecorder
.
AudioSource
.
MIC
);
mRecorder
.
setOutputFormat
(
MediaRecorder
.
OutputFormat
.
THREE_GPP
);
mRecorder
.
setOutputFile
(
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios/"
+
fileName
);
mRecorder
.
setAudioEncoder
(
MediaRecorder
.
AudioEncoder
.
AMR_NB
);
try
{
mRecorder
.
prepare
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
mRecorder
.
start
();
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
());
// to start from 00:00
chronometer
.
start
();
}
private
void
stopRecording
()
{
mRecorder
.
stop
();
mRecorder
.
release
();
mRecorder
=
null
;
chronometer
.
stop
();
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
());
Toast
.
makeText
(
getContext
(),
"Recording saved successfully."
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/RecorderActivity.java
deleted
100644 → 0
View file @
b9db25b6
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
;
import
androidx.annotation.RequiresApi
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.core.content.ContextCompat
;
import
android.Manifest
;
import
android.content.pm.PackageManager
;
import
android.media.MediaPlayer
;
import
android.media.MediaRecorder
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.SystemClock
;
import
android.transition.TransitionManager
;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.Chronometer
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
android.widget.LinearLayout
;
import
android.widget.SeekBar
;
import
android.widget.Toast
;
import
com.example.mynotepad.R
;
import
java.io.File
;
import
java.io.IOException
;
public
class
RecorderActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
private
Button
start_stopBtn
;
private
ImageView
imageViewPlayPause
;
private
SeekBar
seekBar
;
private
boolean
isRecording
=
false
,
isPlaying
=
false
;
private
Chronometer
chronometer
;
private
LinearLayout
linearLayoutRecorder
;
private
MediaRecorder
mRecorder
;
private
MediaPlayer
mPlayer
;
private
int
RECORD_AUDIO_REQUEST_CODE
=
123
;
private
String
fileName
=
null
;
private
int
lastProgress
=
0
;
private
Handler
mHandler
=
new
Handler
();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_recorder
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
getPermissionToRecordAudio
();
}
init
();
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
public
void
getPermissionToRecordAudio
()
{
if
(
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
RECORD_AUDIO
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
||
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
!=
PackageManager
.
PERMISSION_GRANTED
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
RECORD_AUDIO
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
RECORD_AUDIO_REQUEST_CODE
);
}
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
M
)
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
String
permissions
[],
int
[]
grantResults
)
{
if
(
requestCode
==
RECORD_AUDIO_REQUEST_CODE
)
{
if
(
grantResults
.
length
==
3
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
&&
grantResults
[
1
]
==
PackageManager
.
PERMISSION_GRANTED
&&
grantResults
[
2
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
Toast
.
makeText
(
this
,
"accepted"
,
Toast
.
LENGTH_SHORT
).
show
();
}
else
{
Toast
.
makeText
(
this
,
"You must give permissions to use this app. App is exiting."
,
Toast
.
LENGTH_SHORT
).
show
();
finishAffinity
();
}
}
}
private
void
init
()
{
start_stopBtn
=
findViewById
(
R
.
id
.
start_stopBtn
);
seekBar
=
findViewById
(
R
.
id
.
seekBar
);
imageViewPlayPause
=
findViewById
(
R
.
id
.
play_pause
);
imageViewPlayPause
.
setImageResource
(
R
.
drawable
.
pause
);
chronometer
=
findViewById
(
R
.
id
.
chronometerTimer
);
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
());
linearLayoutRecorder
=
findViewById
(
R
.
id
.
linearLayoutRecorder
);
start_stopBtn
.
setOnClickListener
(
this
);
imageViewPlayPause
.
setOnClickListener
(
this
);
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
@Override
public
void
onClick
(
View
view
)
{
if
(
start_stopBtn
.
getId
()
==
view
.
getId
())
{
if
(
isRecording
)
{
isRecording
=
false
;
prepareForStopRecording
();
stopRecording
();
}
else
{
isRecording
=
true
;
prepareforRecording
();
startRecording
();
}
}
else
if
(
view
.
getId
()
==
imageViewPlayPause
.
getId
())
{
if
(
isPlaying
)
{
isPlaying
=
false
;
stopPlaying
();
}
else
{
isPlaying
=
true
;
startPlaying
();
}
}
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
private
void
prepareForStopRecording
()
{
TransitionManager
.
beginDelayedTransition
(
linearLayoutRecorder
);
start_stopBtn
.
setBackground
(
getResources
().
getDrawable
(
R
.
drawable
.
start_stop_bg
));
}
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
KITKAT
)
private
void
prepareforRecording
()
{
TransitionManager
.
beginDelayedTransition
(
linearLayoutRecorder
);
start_stopBtn
.
setBackground
(
getResources
().
getDrawable
(
R
.
drawable
.
stop_btn_bg
));
}
private
void
startRecording
()
{
mRecorder
=
new
MediaRecorder
();
mRecorder
.
setAudioSource
(
MediaRecorder
.
AudioSource
.
MIC
);
mRecorder
.
setOutputFormat
(
MediaRecorder
.
OutputFormat
.
THREE_GPP
);
File
root
=
android
.
os
.
Environment
.
getExternalStorageDirectory
();
File
file
=
new
File
(
root
.
getAbsolutePath
()
+
"/VoiceRecorderSimplifiedCoding/Audios"
);
if
(!
file
.
exists
())
{
file
.
mkdirs
();
//create a file if it does not exists
}
fileName
=
root
.
getAbsolutePath
()
+
"/VoiceRecorderSimplifiedCoding/Audios/"
+
String
.
valueOf
(
System
.
currentTimeMillis
()
+
".mp3"
);
Log
.
d
(
"filename"
,
fileName
);
mRecorder
.
setOutputFile
(
fileName
);
mRecorder
.
setAudioEncoder
(
MediaRecorder
.
AudioEncoder
.
AMR_NB
);
try
{
mRecorder
.
prepare
();
mRecorder
.
start
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
lastProgress
=
0
;
seekBar
.
setProgress
(
0
);
stopPlaying
();
// making the imageview a stop button
//starting the chronometer
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
());
chronometer
.
start
();
}
private
void
stopRecording
()
{
try
{
mRecorder
.
stop
();
mRecorder
.
release
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
mRecorder
=
null
;
chronometer
.
stop
();
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
());
Toast
.
makeText
(
this
,
"Recording saved successfully."
,
Toast
.
LENGTH_SHORT
).
show
();
}
private
void
stopPlaying
()
{
try
{
mPlayer
.
release
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
mPlayer
=
null
;
imageViewPlayPause
.
setImageResource
(
R
.
drawable
.
play
);
chronometer
.
stop
();
}
private
void
startPlaying
()
{
mPlayer
=
new
MediaPlayer
();
try
{
mPlayer
.
setDataSource
(
fileName
);
mPlayer
.
prepare
();
mPlayer
.
start
();
}
catch
(
IOException
e
)
{
Log
.
e
(
"LOG_TAG"
,
"prepare() failed"
);
}
imageViewPlayPause
.
setImageResource
(
R
.
drawable
.
pause
);
//set seekBar
seekBar
.
setProgress
(
lastProgress
);
mPlayer
.
seekTo
(
lastProgress
);
seekBar
.
setMax
(
mPlayer
.
getDuration
());
seekUpdation
();
chronometer
.
start
();
//startPlaying
mPlayer
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
@Override
public
void
onCompletion
(
MediaPlayer
mp
)
{
imageViewPlayPause
.
setImageResource
(
R
.
drawable
.
play
);
isPlaying
=
false
;
chronometer
.
stop
();
}
});
seekBar
.
setOnSeekBarChangeListener
(
new
SeekBar
.
OnSeekBarChangeListener
()
{
@Override
public
void
onProgressChanged
(
SeekBar
seekBar
,
int
progress
,
boolean
fromUser
)
{
if
(
mPlayer
!=
null
&&
fromUser
)
{
mPlayer
.
seekTo
(
progress
);
chronometer
.
setBase
(
SystemClock
.
elapsedRealtime
()
-
mPlayer
.
getCurrentPosition
());
lastProgress
=
progress
;
}
}
@Override
public
void
onStartTrackingTouch
(
SeekBar
seekBar
)
{
}
@Override
public
void
onStopTrackingTouch
(
SeekBar
seekBar
)
{
}
});
}
private
void
seekUpdation
()
{
if
(
mPlayer
!=
null
)
{
int
mCurrentPosition
=
mPlayer
.
getCurrentPosition
();
seekBar
.
setProgress
(
mCurrentPosition
);
lastProgress
=
mCurrentPosition
;
}
mHandler
.
postDelayed
(
runnable
,
100
);
}
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
seekUpdation
();
}
};
}
/* private void initViews() {
imageViewRecord = (ImageView) findViewById(R.id.imageViewRecord);
imageViewStop = (ImageView) findViewById(R.id.imageViewStop);
imageViewPlay = (ImageView) findViewById(R.id.imageViewPlay);
linearLayoutPlay = (LinearLayout) findViewById(R.id.linearLayoutPlay);
seekBar = (SeekBar) findViewById(R.id.seekBar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.list_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.item_list:
gotoRecodingListActivity();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void gotoRecodingListActivity() {
Intent intent = new Intent(this, RecordingListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}*/
\ No newline at end of file
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesActivity.java
View file @
6ed5866a
...
...
@@ -27,129 +27,12 @@ import java.util.ArrayList;
import
static
com
.
example
.
mynotepad
.
MainActivity
.
noteDataBase
;
public
class
VoiceMassagesActivity
extends
AppCompatActivity
{
private
FloatingActionButton
allVoiceBtn
;
private
RecyclerView
recyclerViewRecordings
;
private
VoiceAdaptor
recordingAdapter
;
private
ArrayList
<
MyVoice
>
myVoiceArrayList
;
private
CustomToolbarOption
customToolbarOption
;
private
MyVoice
myChosenVoice
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_voice_massages
);
init
();
fetchRecordings
();
addListener
();
}
/* @Override
protected void onResume() {
super.onResume();
init();
}*/
private
void
init
()
{
customToolbarOption
=
findViewById
(
R
.
id
.
customToolbarOption
);
customToolbarOption
.
setVisibility
(
View
.
GONE
);
myVoiceArrayList
=
new
ArrayList
<>();
allVoiceBtn
=
findViewById
(
R
.
id
.
addVoiceButton
);
/** enabling back button ***/
getSupportActionBar
().
setDisplayHomeAsUpEnabled
(
true
);
/** setting up recyclerView **/
recyclerViewRecordings
=
findViewById
(
R
.
id
.
recyclerView
);
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
this
,
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerViewRecordings
.
setHasFixedSize
(
true
);
}
private
void
fetchRecordings
()
{
File
root
=
android
.
os
.
Environment
.
getExternalStorageDirectory
();
String
path
=
root
.
getAbsolutePath
()
+
"/VoiceRecorderSimplifiedCoding/Audios"
;
Log
.
d
(
"Files"
,
"Path: "
+
path
);
File
directory
=
new
File
(
path
);
File
[]
files
=
directory
.
listFiles
();
// Log.d("Files", "Size: " + files.length);
if
(
files
!=
null
)
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
Log
.
d
(
"Files"
,
"FileName:"
+
files
[
i
].
getName
());
String
fileName
=
files
[
i
].
getName
();
String
recordingUri
=
root
.
getAbsolutePath
()
+
"/VoiceRecorderSimplifiedCoding/Audios/"
+
fileName
;
MyVoice
myVoice
=
new
MyVoice
(
recordingUri
,
fileName
,
false
);
myVoiceArrayList
.
add
(
myVoice
);
}
}
recordingAdapter
=
new
VoiceAdaptor
(
this
,
myVoiceArrayList
);
recyclerViewRecordings
.
setAdapter
(
recordingAdapter
);
}
private
void
addListener
()
{
allVoiceBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
Intent
intent
=
new
Intent
(
VoiceMassagesActivity
.
this
,
RecorderActivity
.
class
);
startActivity
(
intent
);
}
});
recordingAdapter
.
setOnVoiceMassageClickListener
(
new
OnVoiceMassageClickListener
()
{
@Override
public
void
onItemLongClicked
(
MyVoice
item
)
{
customToolbarOption
.
setVisibility
(
View
.
VISIBLE
);
customToolbarOption
.
hideStar
();
myChosenVoice
=
item
;
}
});
//add listener to custom toolbar option and set being archived or not to be saved in database
customToolbarOption
.
setCustomToolbarOptionListener
(
new
CustomToolbarOptionListener
()
{
@Override
public
void
onStarClicked
()
{
}
@Override
public
void
onDeleteClicked
()
{
deleteClicked
();
}
@Override
public
void
onCloseClicked
()
{
customToolbarOption
.
setVisibility
(
View
.
GONE
);
}
});
}
private
void
deleteClicked
()
{
AlertDialog
.
Builder
alert
=
new
AlertDialog
.
Builder
(
VoiceMassagesActivity
.
this
);
alert
.
setMessage
(
"are you sure you wanna delete it ??? "
);
alert
.
setPositiveButton
(
"yes"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
myVoiceArrayList
.
remove
(
myChosenVoice
);
System
.
out
.
println
(
myChosenVoice
.
getFileName
()
+
" "
+
myChosenVoice
.
getUri
()
);
new
File
(
myChosenVoice
.
getFileName
()).
delete
();
init
();
fetchRecordings
();
addListener
();
}
});
alert
.
setNegativeButton
(
"no"
,
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialogInterface
.
cancel
();
}
});
alert
.
show
();
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
0 → 100644
View file @
6ed5866a
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
.
VoiceMassagesRecyclerView
;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
public
class
TimeAgo
{
Date
now
=
new
Date
();
/* public String getTimeAgo(long duration){
long seconds = TimeUnit.MILLISECONDS.toSeconds(now.getTime() - duration);
long minutes = TimeUnit.MINUTES.toMinutes(now.getTime() - duration);
long hours = TimeUnit.HOURS.toHours(now.getTime() - duration);
long days = TimeUnit.DAYS.toDays(now.getTime() - duration);
if (seconds <)
}*/
}
app/src/main/res/anim/fade_in.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:fromAlpha=
"0"
android:toAlpha=
"1"
android:duration=
"300"
/>
<scale
android:fromXScale=
"40%"
android:fromYScale=
"40%"
android:toXScale=
"100%"
android:toYScale=
"100%"
android:duration=
"300"
android:pivotX=
"50%"
android:pivotY=
"50%"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/fade_out.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<alpha
android:fromAlpha=
"1"
android:toAlpha=
"0"
android:duration=
"300"
/>
<scale
android:fromXScale=
"100%"
android:fromYScale=
"100%"
android:toXScale=
"40%"
android:toYScale=
"40%"
android:duration=
"300"
android:pivotX=
"50%"
android:pivotY=
"50%"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/slide_in.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:fromXDelta=
"100%"
android:fromYDelta=
"0%"
android:toXDelta=
"0%"
android:toYDelta=
"0%"
android:duration=
"300"
/>
</set>
\ No newline at end of file
app/src/main/res/anim/slide_out.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<set
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<translate
android:fromXDelta=
"0%"
android:fromYDelta=
"0%"
android:toXDelta=
"100%"
android:toYDelta=
"0%"
android:duration=
"300"
/>
</set>
\ No newline at end of file
app/src/main/res/drawable/media_header_bg.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item>
<shape>
<solid
android:color=
"#3A478C"
/>
<corners
android:topLeftRadius=
"12dp"
android:topRightRadius=
"12dp"
/>
</shape>
</item>
</selector>
\ No newline at end of file
app/src/main/res/drawable/mic.xml
0 → 100644
View file @
6ed5866a
<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=
"M12,14c1.66,0 2.99,-1.34 2.99,-3L15,5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6c0,1.66 1.34,3 3,3zM17.3,11c0,3 -2.54,5.1 -5.3,5.1S6.7,14 6.7,11L5,11c0,3.41 2.72,6.23 6,6.72L11,21h2v-3.28c3.28,-0.48 6,-3.3 6,-6.72h-1.7z"
/>
</vector>
app/src/main/res/drawable/music.xml
0 → 100644
View file @
6ed5866a
<vector
android:height=
"24dp"
android:tint=
"#FFFFFF"
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,3v10.55c-0.59,-0.34 -1.27,-0.55 -2,-0.55 -2.21,0 -4,1.79 -4,4s1.79,4 4,4 4,-1.79 4,-4V7h4V3h-6z"
/>
</vector>
app/src/main/res/drawable/player_bg.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item>
<shape>
<solid
android:color=
"#DC35438C"
/>
<corners
android:radius=
"0dp"
/>
</shape>
</item>
</selector>
\ No newline at end of file
app/src/main/res/drawable/white_play_arrow.xml
0 → 100644
View file @
6ed5866a
<vector
android:height=
"40dp"
android:tint=
"#FFFFFF"
android:viewportHeight=
"24"
android:viewportWidth=
"24"
android:width=
"40dp"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<path
android:fillColor=
"@android:color/white"
android:pathData=
"M8,5v14l11,-7z"
/>
</vector>
app/src/main/res/layout/activity_voice_massages.xml
View file @
6ed5866a
...
...
@@ -4,72 +4,15 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".MenuFeatures.VoiceMassages.VoiceMassagesActivity"
>
<FrameLayout
<fragment
android:id=
"@+id/fragment_container"
android:name=
"androidx.navigation.fragment.NavHostFragment"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<FrameLayout
android:id=
"@+id/voiceToolbar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/imageView7"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:scaleType=
"fitXY"
app:srcCompat=
"@drawable/index"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:enabled=
"false"
android:text=
"all voice massages"
android:textColor=
"#02091E"
android:textSize=
"26dp"
/>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id=
"@+id/customToolbarOption"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
/>
</FrameLayout>
</FrameLayout>
<FrameLayout
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:layout_width=
"409dp"
android:layout_height=
"match_parent"
android:background=
"#4883B5DD"
tools:layout_editor_absoluteX=
"1dp"
tools:layout_editor_absoluteY=
"1dp"
/>
app:defaultNavHost=
"true"
app:navGraph=
"@navigation/nav_graph"
/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id=
"@+id/addVoiceButton"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginRight=
"30dp"
android:layout_marginBottom=
"30dp"
android:clickable=
"true"
android:src=
"@drawable/add"
app:backgroundTint=
"#5266D5"
tools:layout_editor_absoluteX=
"310dp"
tools:layout_editor_absoluteY=
"612dp"
/>
</RelativeLayout>
</FrameLayout>
</LinearLayout>
app/src/main/res/layout/custom_voice_item.xml
View file @
6ed5866a
...
...
@@ -8,8 +8,8 @@
android:id=
"@+id/start_stopBtn"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_alignParent
Righ
t=
"true"
android:layout_margin
Righ
t=
"20dp"
android:layout_alignParent
Lef
t=
"true"
android:layout_margin
Lef
t=
"20dp"
android:layout_centerVertical=
"true"
android:background=
"@drawable/start_stop_bg"
>
...
...
@@ -28,8 +28,9 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_toLeftOf=
"@id/start_stopBtn"
android:orientation=
"vertical"
>
android:layout_toRightOf=
"@id/start_stopBtn"
android:orientation=
"vertical"
android:layout_marginLeft=
"10dp"
>
<TextView
android:id=
"@+id/voiceName"
android:layout_width=
"match_parent"
...
...
@@ -41,6 +42,17 @@
android:gravity=
"center_vertical"
android:layout_marginLeft=
"10dp"
/>
<TextView
android:id=
"@+id/voiceTime"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_marginRight=
"10dp"
android:textSize=
"8dp"
android:text=
"time"
android:gravity=
"center_vertical"
android:layout_marginLeft=
"10dp"
/>
<SeekBar
android:id=
"@+id/seekBar"
android:layout_width=
"match_parent"
...
...
app/src/main/res/layout/fragment_audio_list.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
tools:context=
".MenuFeatures.VoiceMassages.AudioListFragment"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<FrameLayout
android:id=
"@+id/voiceToolbar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<ImageView
android:id=
"@+id/imageView7"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
android:scaleType=
"fitXY"
android:src=
"@drawable/index"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:enabled=
"false"
android:text=
"all voice massages"
android:textColor=
"#02091E"
android:textSize=
"26dp"
/>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id=
"@+id/customToolbarOption"
android:layout_width=
"match_parent"
android:layout_height=
"50dp"
/>
</FrameLayout>
</FrameLayout>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:layout_width=
"409dp"
android:layout_height=
"match_parent"
android:layout_marginTop=
"50dp"
android:background=
"#4883B5DD"
tools:layout_editor_absoluteX=
"1dp"
tools:layout_editor_absoluteY=
"1dp"
/>
<include
layout=
"@layout/player_sheet"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
app/src/main/res/layout/
activity_recorder
.xml
→
app/src/main/res/layout/
fragment_record
.xml
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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=
"match_parent"
android:orientation=
"vertical"
tools:context=
".MenuFeatures.VoiceMassages.RecorderActivity"
>
tools:context=
".MenuFeatures.VoiceMassages.RecordFragment"
>
<ImageView
android:id=
"@+id/imageView8"
...
...
@@ -13,68 +11,56 @@
android:layout_height=
"50dp"
android:layout_marginTop=
"0dp"
android:scaleType=
"fitXY"
app:srcCompat=
"@drawable/index"
/>
android:src=
"@drawable/index"
/>
<LinearLayout
android:id=
"@+id/linearLayoutRecorder"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_marginTop=
"20dp"
android:layout_below=
"@+id/imageView8"
android:layout_alignParentBottom=
"@id/imageView8"
android:layout_marginTop=
"80dp"
android:orientation=
"vertical"
>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:src=
"@drawable/stones"
/>
<Chronometer
android:id=
"@+id/chronometerTimer"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"40dp"
android:textColor=
"#016D91"
android:textSize=
"60sp"
/>
<SeekBar
android:id=
"@+id/seekBar"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginTop=
"20dp"
android:layout_weight=
"1"
android:thumb=
"@android:drawable/presence_invisible"
/>
</LinearLayout>
<Button
android:id=
"@+id/start_stopBtn"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
<ImageButton
android:id=
"@+id/recordBtn"
android:layout_width=
"60dp"
android:layout_height=
"60dp"
android:layout_alignParentBottom=
"true"
android:layout_centerHorizontal=
"true"
android:layout_marginBottom=
"50dp"
android:background=
"@drawable/start_stop_bg"
/>
android:background=
"@drawable/start_stop_bg"
android:src=
"@drawable/mic"
/>
<ImageView
android:id=
"@+id/
play_pause
"
android:id=
"@+id/
recordList
"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_alignBottom=
"@id/
start_stop
Btn"
android:layout_margin
Right=
"3
0dp"
android:layout_to
LeftOf=
"@id/start_stop
Btn"
android:src=
"@drawable/
play
"
/>
android:layout_alignBottom=
"@id/
record
Btn"
android:layout_margin
Left=
"4
0dp"
android:layout_to
RightOf=
"@id/record
Btn"
android:src=
"@drawable/
list
"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignBottom=
"@id/start_stopBtn"
android:layout_marginLeft=
"30dp"
android:layout_toRightOf=
"@id/start_stopBtn"
>
<ImageView
android:id=
"@+id/saveVoice"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:src=
"@drawable/square"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/player_sheet.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id=
"@+id/player_sheet"
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"
app:layout_behavior=
"com.google.android.material.bottomsheet.BottomSheetBehavior"
app:behavior_hideable=
"true"
app:behavior_peekHeight=
"70dp"
android:orientation=
"vertical"
>
<LinearLayout
android:id=
"@+id/linearLayout"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginTop=
"10dp"
android:background=
"@drawable/media_header_bg"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
tools:layout_editor_absoluteY=
"4dp"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"5"
android:paddingTop=
"10dp"
android:paddingBottom=
"10dp"
app:srcCompat=
"@drawable/music"
tools:ignore=
"VectorDrawableCompat"
/>
<TextView
android:id=
"@+id/player_header_name"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"3"
android:paddingLeft=
"10dp"
android:paddingTop=
"10dp"
android:paddingBottom=
"10dp"
android:text=
"@string/media_player"
android:textColor=
"#FFFFFF"
android:gravity=
"center_vertical"
android:textSize=
"20dp"
/>
<TextView
android:id=
"@+id/player_header_title"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"3"
android:gravity=
"center_vertical"
android:paddingTop=
"10dp"
android:paddingEnd=
"20dp"
android:paddingRight=
"20dp"
android:paddingBottom=
"10dp"
android:text=
"@string/not_playing"
android:textAlignment=
"textEnd"
android:textColor=
"#FFFFFF"
android:textSize=
"20dp"
tools:ignore=
"RtlCompat"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/player_bg"
>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:text=
"@string/file_name"
android:textAlignment=
"center"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
android:textSize=
"16dp"
android:gravity=
"center_horizontal"
android:textColor=
"@color/white"
tools:ignore=
"MissingConstraints"
/>
<ImageButton
android:id=
"@+id/player_play_btn"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_marginTop=
"28dp"
android:background=
"#0035438C"
android:padding=
"5dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.498"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView3"
app:srcCompat=
"@drawable/white_play_arrow"
tools:ignore=
"VectorDrawableCompat"
/>
<ImageButton
android:id=
"@+id/imageView11"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"@+id/player_play_btn"
app:layout_constraintEnd_toStartOf=
"@+id/player_play_btn"
app:layout_constraintHorizontal_bias=
"0.519"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"@+id/player_play_btn"
android:background=
"#0035438C"
app:layout_constraintVertical_bias=
"0.545"
app:srcCompat=
"@android:drawable/ic_media_rew"
/>
<ImageButton
android:id=
"@+id/imageView12"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:layout_constraintBottom_toBottomOf=
"@+id/player_play_btn"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toEndOf=
"@+id/player_play_btn"
app:layout_constraintTop_toTopOf=
"@+id/player_play_btn"
android:background=
"#0035438C"
app:srcCompat=
"@android:drawable/ic_media_ff"
/>
<SeekBar
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"20dp"
android:layout_marginTop=
"16dp"
android:thumb=
"@android:drawable/presence_invisible"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/player_play_btn"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/navigation/nav_graph.xml
0 → 100644
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<navigation
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:id=
"@+id/nav_graph"
app:startDestination=
"@id/recordFragment"
tools:ignore=
"UnusedNavigation"
>
<fragment
android:id=
"@+id/recordFragment"
android:name=
"com.example.mynotepad.MenuFeatures.VoiceMassages.RecordFragment"
android:label=
"fragment_record"
tools:layout=
"@layout/fragment_record"
>
<action
android:id=
"@+id/action_recordFragment_to_audioListFragment"
app:destination=
"@id/audioListFragment"
app:exitAnim=
"@anim/fade_out"
app:enterAnim=
"@anim/slide_in"
app:popEnterAnim=
"@anim/fade_in"
app:popExitAnim=
"@anim/slide_out"
/>
</fragment>
<fragment
android:id=
"@+id/audioListFragment"
android:name=
"com.example.mynotepad.MenuFeatures.VoiceMassages.AudioListFragment"
android:label=
"fragment_audio_list"
tools:layout=
"@layout/fragment_audio_list"
/>
</navigation>
\ No newline at end of file
app/src/main/res/values/colors.xml
View file @
6ed5866a
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color
name=
"colorPrimary"
>
#
6200E
E
</color>
<color
name=
"colorPrimaryDark"
>
#3
700B3
</color>
<color
name=
"colorAccent"
>
#
03DAC5
</color>
<color
name=
"colorPrimary"
>
#
457FA
E
</color>
<color
name=
"colorPrimaryDark"
>
#3
A478C
</color>
<color
name=
"colorAccent"
>
#
41A69D
</color>
</resources>
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
6ed5866a
...
...
@@ -12,4 +12,7 @@
<string
name=
"chosendate"
>
chosenDate
</string>
<string
name=
"dots"
>
...
</string>
<string
name=
"archived"
>
archived
</string>
<string
name=
"not_playing"
>
Not playing
</string>
<string
name=
"media_player"
>
Media player
</string>
<string
name=
"file_name"
>
file name
</string>
</resources>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
6ed5866a
<resources>
<!-- Base application theme. -->
<style
name=
"AppTheme"
parent=
"Theme.
AppCompat.Light.Dark
ActionBar"
>
<style
name=
"AppTheme"
parent=
"Theme.
MaterialComponents.Light.No
ActionBar"
>
<!-- Customize your theme here. -->
<item
name=
"colorPrimary"
>
@color/colorPrimary
</item>
<item
name=
"colorPrimaryDark"
>
@color/colorPrimaryDark
</item>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment