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
dbb33fb2
Commit
dbb33fb2
authored
Oct 04, 2020
by
9731301
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug some parts
parent
6ed5866a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
93 deletions
+116
-93
AudioListFragment.java
...notepad/MenuFeatures/VoiceMassages/AudioListFragment.java
+5
-4
TimeAgo.java
...ures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
+24
-4
VoiceAdaptor.java
...VoiceMassages/VoiceMassagesRecyclerView/VoiceAdaptor.java
+10
-10
custom_voice_item.xml
app/src/main/res/layout/custom_voice_item.xml
+4
-12
player_sheet.xml
app/src/main/res/layout/player_sheet.xml
+73
-63
No files found.
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/AudioListFragment.java
View file @
dbb33fb2
...
...
@@ -15,6 +15,7 @@ import android.util.Log;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.LinearLayout
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOption
;
import
com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener
;
...
...
@@ -23,7 +24,6 @@ import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerVie
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
;
...
...
@@ -90,7 +90,7 @@ public class AudioListFragment extends Fragment {
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
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
}
}
...
...
@@ -105,6 +105,7 @@ public class AudioListFragment extends Fragment {
private
void
addListener
()
{
recordingAdapter
.
setOnVoiceMassageClickListener
(
new
OnVoiceMassageClickListener
()
{
@Override
public
void
onItemLongClicked
(
MyVoice
item
)
{
customToolbarOption
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -138,7 +139,7 @@ public class AudioListFragment extends Fragment {
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
myVoiceArrayList
.
remove
(
myChosenVoice
);
System
.
out
.
println
(
myChosenVoice
.
getFileName
()
+
" "
+
myChosenVoice
.
getUri
()
);
System
.
out
.
println
(
myChosenVoice
.
getFileName
()
+
" "
+
myChosenVoice
.
getUri
()
);
new
File
(
myChosenVoice
.
getFileName
()).
delete
();
customToolbarOption
.
setVisibility
(
View
.
GONE
);
recyclerViewRecordings
.
setLayoutManager
(
new
LinearLayoutManager
(
getContext
(),
LinearLayoutManager
.
VERTICAL
,
false
));
...
...
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/TimeAgo.java
View file @
dbb33fb2
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){
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 <)
}*/
if
(
seconds
<
60
){
return
"just now"
;
}
else
if
(
minutes
==
1
){
return
"a minute ago"
;
}
else
if
(
minutes
>
1
&&
minutes
<
60
){
return
minutes
+
" minutes ago"
;
}
else
if
(
hours
==
1
){
return
"an hour ago"
;
}
else
if
(
hours
>
1
&&
hours
<
24
){
return
"hours ago"
;
}
else
if
(
days
==
1
){
return
"a day ago"
;
}
else
{
return
"days ago"
;
}
}
}
app/src/main/java/com/example/mynotepad/MenuFeatures/VoiceMassages/VoiceMassagesRecyclerView/VoiceAdaptor.java
View file @
dbb33fb2
...
...
@@ -61,16 +61,16 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
holder
.
imageViewStop
.
setVisibility
(
View
.
VISIBLE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
GONE
);
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
holder
.
seekBar
.
setVisibility
(
View
.
VISIBLE
);
holder
.
seekUpdation
(
holder
);
//
holder.seekBar.setVisibility(View.VISIBLE);
//
holder.seekUpdation(holder);
}
else
{
holder
.
imageViewStop
.
setVisibility
(
View
.
GONE
);
holder
.
imageViewPlay
.
setVisibility
(
View
.
VISIBLE
);
TransitionManager
.
beginDelayedTransition
((
ViewGroup
)
holder
.
itemView
);
holder
.
seekBar
.
setVisibility
(
View
.
GONE
);
//
holder.seekBar.setVisibility(View.GONE);
}
holder
.
manageSeekBar
(
holder
);
//
holder.manageSeekBar(holder);
}
...
...
@@ -86,7 +86,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
class
VoiceViewHolder
extends
RecyclerView
.
ViewHolder
implements
View
.
OnLongClickListener
{
FrameLayout
startStopBtn
;
ImageView
imageViewPlay
,
imageViewStop
;
SeekBar
seekBar
;
//
SeekBar seekBar;
TextView
textViewName
;
private
String
recordingUri
;
private
Handler
mHandler
=
new
Handler
();
...
...
@@ -97,7 +97,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
imageViewPlay
=
itemView
.
findViewById
(
R
.
id
.
playImg
);
imageViewStop
=
itemView
.
findViewById
(
R
.
id
.
pauseImg
);
seekBar
=
itemView
.
findViewById
(
R
.
id
.
seekBar
);
//
seekBar = itemView.findViewById(R.id.seekBar);
textViewName
=
itemView
.
findViewById
(
R
.
id
.
voiceName
);
startStopBtn
=
itemView
.
findViewById
(
R
.
id
.
start_stopBtn
);
imageViewStop
.
setVisibility
(
View
.
GONE
);
...
...
@@ -144,7 +144,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
else
{
startPlaying
(
myVoice
,
position
);
myVoice
.
setPlaying
(
true
);
seekBar
.
setMax
(
mPlayer
.
getDuration
());
//
seekBar.setMax(mPlayer.getDuration());
Log
.
d
(
"isPlayin"
,
"False"
);
}
notifyItemChanged
(
position
);
...
...
@@ -156,7 +156,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
});
}
public
void
manageSeekBar
(
VoiceViewHolder
holder
)
{
/*
public void manageSeekBar(VoiceViewHolder holder) {
holder.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
...
...
@@ -192,7 +192,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
holder.seekBar.setProgress(mCurrentPosition);
}
mHandler.postDelayed(runnable, 100);
}
}
*/
private
void
stopPlaying
()
{
try
{
...
...
@@ -214,7 +214,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
Log
.
e
(
"LOG_TAG"
,
"prepare() failed"
);
}
//showing the pause button
seekBar
.
setMax
(
mPlayer
.
getDuration
());
//
seekBar.setMax(mPlayer.getDuration());
isPlaying
=
true
;
mPlayer
.
setOnCompletionListener
(
new
MediaPlayer
.
OnCompletionListener
()
{
...
...
app/src/main/res/layout/custom_voice_item.xml
View file @
dbb33fb2
...
...
@@ -22,7 +22,7 @@
<ImageView
android:id=
"@+id/pauseImg"
android:layout_width=
"match_parent"
android:layout_height=
"
37dp
"
android:layout_height=
"
match_parent
"
android:src=
"@drawable/pause"
/>
</FrameLayout>
<LinearLayout
...
...
@@ -46,20 +46,12 @@
android:id=
"@+id/voiceTime"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"
1
"
android:layout_weight=
"
2
"
android:layout_marginRight=
"10dp"
android:textSize=
"
8
dp"
android:textSize=
"
12
dp"
android:text=
"time"
android:gravity=
"
center_vertical
"
android:gravity=
"
top
"
android:layout_marginLeft=
"10dp"
/>
<SeekBar
android:id=
"@+id/seekBar"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"10dp"
android:layout_weight=
"2"
android:thumb=
"@android:drawable/presence_invisible"
/>
</LinearLayout>
</RelativeLayout>
app/src/main/res/layout/player_sheet.xml
View file @
dbb33fb2
<?xml version="1.0" encoding="utf-8"?>
<
Linear
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/player_sheet"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
...
...
@@ -15,12 +15,13 @@
android:id=
"@+id/linearLayout"
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginTop=
"1
0
dp"
android:layout_marginTop=
"1
7
dp"
android:background=
"@drawable/media_header_bg"
android:orientation=
"horizontal"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
tools:layout_editor_absoluteY=
"4dp"
>
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"MissingConstraints"
>
<ImageView
...
...
@@ -37,12 +38,12 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_weight=
"3"
android:gravity=
"center_vertical"
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
...
...
@@ -61,21 +62,30 @@
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"
>
android:background=
"@drawable/player_bg"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/linearLayout"
>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:gravity=
"center_horizontal"
android:text=
"@string/file_name"
android:textAlignment=
"center"
android:textColor=
"@color/white"
android:textSize=
"16dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
android:textSize=
"16dp"
android:gravity=
"center_horizontal"
android:textColor=
"@color/white"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"MissingConstraints"
/>
<ImageButton
...
...
@@ -96,12 +106,12 @@
android:id=
"@+id/imageView11"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"#0035438C"
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"
/>
...
...
@@ -109,11 +119,11 @@
android:id=
"@+id/imageView12"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:background=
"#0035438C"
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
...
...
@@ -127,6 +137,6 @@
app:layout_constraintHorizontal_bias=
"0.0"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/player_play_btn"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
\ No newline at end of file
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
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