Commit dbb33fb2 authored by 9731301's avatar 9731301

debug some parts

parent 6ed5866a
......@@ -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));
......@@ -153,4 +154,4 @@ public class AudioListFragment extends Fragment {
});
alert.show();
}
}
\ No newline at end of file
}
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";
}
}
}
......@@ -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() {
......
......@@ -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="8dp"
android:textSize="12dp"
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>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
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="10dp"
android:layout_marginTop="17dp"
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,72 +62,81 @@
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"
android:background="@drawable/player_bg"
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"
tools:ignore="MissingConstraints" />
app:layout_constraintTop_toBottomOf="@+id/linearLayout">
<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" />
<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"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints" />
<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/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/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" />
<ImageButton
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"
app:layout_constraintVertical_bias="0.545"
app:srcCompat="@android:drawable/ic_media_rew" />
<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>
<ImageButton
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"
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
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment