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
e27b1a0d
Commit
e27b1a0d
authored
Oct 04, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add duration with help of TimeAgo
parent
dbb33fb2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
170 additions
and
108 deletions
+170
-108
AudioListFragment.java
...notepad/MenuFeatures/VoiceMassages/AudioListFragment.java
+13
-4
MyVoice.java
...ures/VoiceMassages/VoiceMassagesRecyclerView/MyVoice.java
+9
-3
TimeAgo.java
...ures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
+1
-1
VoiceAdaptor.java
...VoiceMassages/VoiceMassagesRecyclerView/VoiceAdaptor.java
+140
-99
white_pause.xml
app/src/main/res/drawable/white_pause.xml
+5
-0
player_sheet.xml
app/src/main/res/layout/player_sheet.xml
+2
-1
No files found.
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/AudioListFragment.java
View file @
e27b1a0d
...
@@ -15,7 +15,10 @@ import android.util.Log;
...
@@ -15,7 +15,10 @@ import android.util.Log;
import
android.view.LayoutInflater
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.ImageButton
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
android.widget.SeekBar
;
import
android.widget.TextView
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener
;
...
@@ -32,12 +35,15 @@ import java.util.ArrayList;
...
@@ -32,12 +35,15 @@ import java.util.ArrayList;
public
class
AudioListFragment
extends
Fragment
{
public
class
AudioListFragment
extends
Fragment
{
private
ConstraintLayout
playerSheet
;
private
ConstraintLayout
playerSheet
;
p
rivate
BottomSheetBehavior
bottomSheetBehavior
;
p
ublic
static
BottomSheetBehavior
bottomSheetBehavior
;
private
RecyclerView
recyclerViewRecordings
;
private
RecyclerView
recyclerViewRecordings
;
private
VoiceAdaptor
recordingAdapter
;
private
VoiceAdaptor
recordingAdapter
;
private
ArrayList
<
MyVoice
>
myVoiceArrayList
;
private
ArrayList
<
MyVoice
>
myVoiceArrayList
;
private
CustomToolbarOption
customToolbarOption
;
private
CustomToolbarOption
customToolbarOption
;
private
MyVoice
myChosenVoice
;
private
MyVoice
myChosenVoice
;
private
ImageButton
playerPlayBtn
;
private
TextView
fileNameTv
,
headerTitleTv
;
private
SeekBar
seekBar
;
@Override
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
public
View
onCreateView
(
LayoutInflater
inflater
,
ViewGroup
container
,
...
@@ -61,7 +67,10 @@ public class AudioListFragment extends Fragment {
...
@@ -61,7 +67,10 @@ public class AudioListFragment extends Fragment {
customToolbarOption
=
v
.
findViewById
(
R
.
id
.
customToolbarOption
);
customToolbarOption
=
v
.
findViewById
(
R
.
id
.
customToolbarOption
);
customToolbarOption
.
setVisibility
(
View
.
GONE
);
customToolbarOption
.
setVisibility
(
View
.
GONE
);
myVoiceArrayList
=
new
ArrayList
<>();
myVoiceArrayList
=
new
ArrayList
<>();
playerPlayBtn
=
v
.
findViewById
(
R
.
id
.
player_play_btn
);
headerTitleTv
=
v
.
findViewById
(
R
.
id
.
player_header_title
);
fileNameTv
=
v
.
findViewById
(
R
.
id
.
textView3
);
seekBar
=
v
.
findViewById
(
R
.
id
.
seekBar
);
recyclerViewRecordings
=
v
.
findViewById
(
R
.
id
.
recyclerView
);
recyclerViewRecordings
=
v
.
findViewById
(
R
.
id
.
recyclerView
);
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
...
@@ -78,11 +87,11 @@ public class AudioListFragment extends Fragment {
...
@@ -78,11 +87,11 @@ public class AudioListFragment extends Fragment {
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
String
fileName
=
files
[
i
].
getName
();
String
fileName
=
files
[
i
].
getName
();
String
recordingUri
=
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios/"
+
fileName
;
String
recordingUri
=
root
.
getAbsolutePath
()
+
"/NotepadVoiceRecorder/Audios/"
+
fileName
;
MyVoice
myVoice
=
new
MyVoice
(
recordingUri
,
fileName
,
false
);
MyVoice
myVoice
=
new
MyVoice
(
recordingUri
,
fileName
,
false
,
files
[
i
].
lastModified
()
);
myVoiceArrayList
.
add
(
myVoice
);
myVoiceArrayList
.
add
(
myVoice
);
}
}
}
}
recordingAdapter
=
new
VoiceAdaptor
(
getContext
(),
myVoiceArrayList
);
recordingAdapter
=
new
VoiceAdaptor
(
getContext
(),
myVoiceArrayList
,
playerPlayBtn
,
fileNameTv
,
headerTitleTv
,
seekBar
);
recyclerViewRecordings
.
setAdapter
(
recordingAdapter
);
recyclerViewRecordings
.
setAdapter
(
recordingAdapter
);
}
}
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/MyVoice.java
View file @
e27b1a0d
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
.
VoiceMassagesRecyclerView
;
package
com
.
example
.
mynotepad
.
MenuFeatures
.
VoiceMassages
.
VoiceMassagesRecyclerView
;
public
class
MyVoice
{
public
class
MyVoice
{
String
Uri
,
fileName
;
private
String
Uri
,
fileName
;
boolean
isPlaying
=
false
;
private
boolean
isPlaying
=
false
;
private
long
lastModified
;
public
MyVoice
(
String
uri
,
String
fileName
,
boolean
isPlaying
)
{
public
MyVoice
(
String
uri
,
String
fileName
,
boolean
isPlaying
,
long
lastModified
)
{
Uri
=
uri
;
Uri
=
uri
;
this
.
fileName
=
fileName
;
this
.
fileName
=
fileName
;
this
.
isPlaying
=
isPlaying
;
this
.
isPlaying
=
isPlaying
;
this
.
lastModified
=
lastModified
;
}
}
public
String
getUri
()
{
public
String
getUri
()
{
...
@@ -25,4 +27,8 @@ public class MyVoice {
...
@@ -25,4 +27,8 @@ public class MyVoice {
public
void
setPlaying
(
boolean
playing
)
{
public
void
setPlaying
(
boolean
playing
)
{
this
.
isPlaying
=
playing
;
this
.
isPlaying
=
playing
;
}
}
public
long
getLastModified
()
{
return
lastModified
;
}
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
View file @
e27b1a0d
...
@@ -5,7 +5,7 @@ import java.util.Date;
...
@@ -5,7 +5,7 @@ import java.util.Date;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
public
class
TimeAgo
{
public
class
TimeAgo
{
Date
now
=
new
Date
();
private
Date
now
=
new
Date
();
public
String
getTimeAgo
(
long
duration
)
{
public
String
getTimeAgo
(
long
duration
)
{
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
now
.
getTime
()
-
duration
);
long
seconds
=
TimeUnit
.
MILLISECONDS
.
toSeconds
(
now
.
getTime
()
-
duration
);
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/VoiceAdaptor.java
View file @
e27b1a0d
...
@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
...
@@ -10,6 +10,7 @@ import android.view.LayoutInflater;
import
android.view.View
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.ViewGroup
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
android.widget.ImageButton
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.SeekBar
;
import
android.widget.SeekBar
;
import
android.widget.TextView
;
import
android.widget.TextView
;
...
@@ -18,7 +19,9 @@ import androidx.annotation.NonNull;
...
@@ -18,7 +19,9 @@ import androidx.annotation.NonNull;
import
androidx.annotation.RequiresApi
;
import
androidx.annotation.RequiresApi
;
import
androidx.recyclerview.widget.RecyclerView
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.example.mynotepad.MenuFeatures.VoiceMassages.AudioListFragment
;
import
com.example.mynotepad.R
;
import
com.example.mynotepad.R
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -30,13 +33,22 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -30,13 +33,22 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
private
boolean
isPlaying
=
false
;
private
boolean
isPlaying
=
false
;
private
int
last_index
=
-
1
;
private
int
last_index
=
-
1
;
private
OnVoiceMassageClickListener
onVoiceMassageClickListener
;
private
OnVoiceMassageClickListener
onVoiceMassageClickListener
;
private
ImageButton
playerPlayBtn
;
private
TextView
fileNameTv
,
headerTitleTv
;
private
SeekBar
seekBar
;
private
TimeAgo
timeAgo
;
public
VoiceAdaptor
(
Context
context
,
ArrayList
<
MyVoice
>
myVoiceArrayList
)
{
public
VoiceAdaptor
(
Context
context
,
ArrayList
<
MyVoice
>
myVoiceArrayList
,
ImageButton
playerPlayBtn
,
TextView
fileNameTv
,
TextView
headerTitleTv
,
SeekBar
seekBar
)
{
this
.
context
=
context
;
this
.
context
=
context
;
this
.
myVoiceArrayList
=
myVoiceArrayList
;
this
.
myVoiceArrayList
=
myVoiceArrayList
;
this
.
playerPlayBtn
=
playerPlayBtn
;
this
.
fileNameTv
=
fileNameTv
;
this
.
headerTitleTv
=
headerTitleTv
;
this
.
seekBar
=
seekBar
;
timeAgo
=
new
TimeAgo
();
}
}
@NonNull
@NonNull
@Override
@Override
public
VoiceViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
public
VoiceViewHolder
onCreateViewHolder
(
@NonNull
ViewGroup
parent
,
int
viewType
)
{
...
@@ -56,21 +68,24 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -56,21 +68,24 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
MyVoice
myVoice
=
myVoiceArrayList
.
get
(
position
);
MyVoice
myVoice
=
myVoiceArrayList
.
get
(
position
);
holder
.
textViewName
.
setText
(
myVoice
.
getFileName
());
holder
.
textViewName
.
setText
(
myVoice
.
getFileName
());
holder
.
textLongAgo
.
setText
(
timeAgo
.
getTimeAgo
(
myVoice
.
getLastModified
()));
if
(
myVoice
.
isPlaying
())
{
if
(
myVoice
.
isPlaying
())
{
holder
.
imageViewStop
.
setVisibility
(
View
.
VISIBLE
);
holder
.
imageViewStop
.
setVisibility
(
View
.
VISIBLE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
GONE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
GONE
);
headerTitleTv
.
setText
(
"playing"
);
playerPlayBtn
.
setImageDrawable
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
white_play_arrow
));
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
// holder.seekBar.setVisibility(View.VISIBLE);
holder
.
seekUpdation
(
holder
);
// holder.seekUpdation(holder);
}
else
{
}
else
{
headerTitleTv
.
setText
(
"not playing"
);
holder
.
imageViewStop
.
setVisibility
(
View
.
GONE
);
holder
.
imageViewStop
.
setVisibility
(
View
.
GONE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
VISIBLE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
VISIBLE
);
playerPlayBtn
.
setImageDrawable
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
white_pause
));
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
// holder.seekBar.setVisibility(View.GONE);
}
}
//
holder.manageSeekBar(holder);
holder
.
manageSeekBar
(
holder
);
}
}
...
@@ -83,36 +98,56 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -83,36 +98,56 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
this
.
onVoiceMassageClickListener
=
onVoiceMassageClickListener
;
this
.
onVoiceMassageClickListener
=
onVoiceMassageClickListener
;
}
}
class
VoiceViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnLongClickListener
{
class
VoiceViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnLongClickListener
{
FrameLayout
startStopBtn
;
private
FrameLayout
startStopBtn
;
ImageView
imageViewPlay
,
imageViewStop
;
private
ImageView
imageViewPlay
,
imageViewStop
;
// SeekBar seekBar;
private
TextView
textViewName
,
textLongAgo
;
TextView
textViewName
;
private
String
recordingUri
;
private
String
recordingUri
;
private
Handler
mHandler
=
new
Handler
();
private
Handler
mHandler
=
new
Handler
();
VoiceViewHolder
holder
;
private
VoiceViewHolder
holder
;
private
int
playingPosition
;
public
VoiceViewHolder
(
View
itemView
)
{
public
VoiceViewHolder
(
View
itemView
)
{
super
(
itemView
);
super
(
itemView
);
imageViewPlay
=
itemView
.
findViewById
(
R
.
id
.
playImg
);
imageViewPlay
=
itemView
.
findViewById
(
R
.
id
.
playImg
);
imageViewStop
=
itemView
.
findViewById
(
R
.
id
.
pauseImg
);
imageViewStop
=
itemView
.
findViewById
(
R
.
id
.
pauseImg
);
// seekBar = itemView.findViewById(R.id.seekBar);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
voiceName
);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
voiceName
);
textLongAgo
=
itemView
.
findViewById
(
R
.
id
.
voiceTime
);
startStopBtn
=
itemView
.
findViewById
(
R
.
id
.
start_stopBtn
);
startStopBtn
=
itemView
.
findViewById
(
R
.
id
.
start_stopBtn
);
imageViewStop
.
setVisibility
(
View
.
GONE
);
imageViewStop
.
setVisibility
(
View
.
GONE
);
itemView
.
setOnLongClickListener
(
this
);
playerPlayBtn
.
setImageDrawable
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
white_play_arrow
)
);
/*
addListener
();
add clickListener to stop or start playing
*/
}
private
void
addListener
()
{
itemView
.
setOnLongClickListener
(
this
);
//add clickListener to stop or start playing
startStopBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
startStopBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
view
)
{
playingPosition
=
getAdapterPosition
();
startAndStopPlaying
(
playingPosition
);
}
});
playerPlayBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
startAndStopPlaying
(
playingPosition
);
}
});
}
private
void
startAndStopPlaying
(
int
position
)
{
int
position
=
getAdapterPosition
();
MyVoice
myVoice
=
myVoiceArrayList
.
get
(
position
);
MyVoice
myVoice
=
myVoiceArrayList
.
get
(
position
);
recordingUri
=
myVoice
.
getUri
();
recordingUri
=
myVoice
.
getUri
();
fileNameTv
.
setText
(
myVoice
.
getFileName
());
//if media player is playing
//if media player is playing
if
(
isPlaying
)
{
if
(
isPlaying
)
{
...
@@ -153,47 +188,6 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -153,47 +188,6 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
}
}
});
}
/* public void manageSeekBar(VoiceViewHolder holder) {
holder.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mPlayer != null && fromUser) {
mPlayer.seekTo(progress);
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
Runnable runnable = new Runnable() {
@Override
public void run() {
seekUpdation(holder);
}
};
private void seekUpdation(VoiceViewHolder holder) {
this.holder = holder;
if (mPlayer != null) {
int mCurrentPosition = mPlayer.getCurrentPosition();
holder.seekBar.setMax(mPlayer.getDuration());
holder.seekBar.setProgress(mCurrentPosition);
}
mHandler.postDelayed(runnable, 100);
}*/
private
void
stopPlaying
()
{
private
void
stopPlaying
()
{
try
{
try
{
mPlayer
.
release
();
mPlayer
.
release
();
...
@@ -205,6 +199,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -205,6 +199,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
}
}
private
void
startPlaying
(
final
MyVoice
audio
,
final
int
position
)
{
private
void
startPlaying
(
final
MyVoice
audio
,
final
int
position
)
{
AudioListFragment
.
bottomSheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
// when u choose an item media player will open automatically
mPlayer
=
new
MediaPlayer
();
mPlayer
=
new
MediaPlayer
();
try
{
try
{
mPlayer
.
setDataSource
(
recordingUri
);
mPlayer
.
setDataSource
(
recordingUri
);
...
@@ -214,7 +209,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -214,7 +209,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
Log
.
e
(
"LOG_TAG"
,
"prepare() failed"
);
Log
.
e
(
"LOG_TAG"
,
"prepare() failed"
);
}
}
//showing the pause button
//showing the pause button
//
seekBar.setMax(mPlayer.getDuration());
seekBar
.
setMax
(
mPlayer
.
getDuration
());
isPlaying
=
true
;
isPlaying
=
true
;
mPlayer
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
mPlayer
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
...
@@ -225,16 +220,53 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -225,16 +220,53 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
}
}
});
});
mPlayer
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
@Override
public
void
onCompletion
(
MediaPlayer
mediaPlayer
)
{
stopPlaying
();
playerPlayBtn
.
setImageDrawable
(
context
.
getResources
().
getDrawable
(
R
.
drawable
.
white_play_arrow
));
headerTitleTv
.
setText
(
"finished"
);
}
});
}
public
void
manageSeekBar
(
VoiceViewHolder
holder
)
{
seekBar
.
setOnSeekBarChangeListener
(
new
SeekBar
.
OnSeekBarChangeListener
()
{
@Override
public
void
onProgressChanged
(
SeekBar
seekBar
,
int
progress
,
boolean
fromUser
)
{
if
(
mPlayer
!=
null
&&
fromUser
)
{
mPlayer
.
seekTo
(
progress
);
}
mHandler
.
postDelayed
(
runnable
,
100
);
}
@Override
public
void
onStartTrackingTouch
(
SeekBar
seekBar
)
{
}
}
@Override
@Override
public
boolean
onLongClick
(
View
view
)
{
public
void
onStopTrackingTouch
(
SeekBar
seekBar
)
{
if
(
onVoiceMassageClickListener
!=
null
)
onVoiceMassageClickListener
.
onItemLongClicked
(
myVoiceArrayList
.
get
(
getAdapterPosition
()));
return
true
;
}
}
});
}
Runnable
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
seekUpdation
(
holder
);
}
};
private
void
seekUpdation
(
VoiceViewHolder
holder
)
{
this
.
holder
=
holder
;
if
(
mPlayer
!=
null
)
{
int
mCurrentPosition
=
mPlayer
.
getCurrentPosition
();
seekBar
.
setMax
(
mPlayer
.
getDuration
());
seekBar
.
setProgress
(
mCurrentPosition
);
}
mHandler
.
postDelayed
(
runnable
,
100
);
}
}
/*
/*
* set all voice items on pause and stop all of them
* set all voice items on pause and stop all of them
*/
*/
...
@@ -245,4 +277,13 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
...
@@ -245,4 +277,13 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
}
}
notifyDataSetChanged
();
notifyDataSetChanged
();
}
}
@Override
public
boolean
onLongClick
(
View
view
)
{
if
(
onVoiceMassageClickListener
!=
null
)
onVoiceMassageClickListener
.
onItemLongClicked
(
myVoiceArrayList
.
get
(
getAdapterPosition
()));
return
true
;
}
}
}
}
app/src/main/res/drawable/white_pause.xml
0 → 100644
View file @
e27b1a0d
<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=
"M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"
/>
</vector>
app/src/main/res/layout/player_sheet.xml
View file @
e27b1a0d
...
@@ -92,7 +92,7 @@
...
@@ -92,7 +92,7 @@
android:id=
"@+id/player_play_btn"
android:id=
"@+id/player_play_btn"
android:layout_width=
"40dp"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:layout_marginTop=
"2
8
dp"
android:layout_marginTop=
"2
4
dp"
android:background=
"#0035438C"
android:background=
"#0035438C"
android:padding=
"5dp"
android:padding=
"5dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
...
@@ -127,6 +127,7 @@
...
@@ -127,6 +127,7 @@
app:srcCompat=
"@android:drawable/ic_media_ff"
/>
app:srcCompat=
"@android:drawable/ic_media_ff"
/>
<SeekBar
<SeekBar
android:id=
"@+id/seekBar"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"20dp"
android:layout_margin=
"20dp"
...
...
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