Commit dbb33fb2 authored by 9731301's avatar 9731301

debug some parts

parent 6ed5866a
...@@ -15,6 +15,7 @@ import android.util.Log; ...@@ -15,6 +15,7 @@ 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.LinearLayout;
import com.example.mynotepad.MenuFeatures.CustomToolbarOption; import com.example.mynotepad.MenuFeatures.CustomToolbarOption;
import com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener; import com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener;
...@@ -23,7 +24,6 @@ import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerVie ...@@ -23,7 +24,6 @@ import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerVie
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.VoiceAdaptor; import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.VoiceAdaptor;
import com.example.mynotepad.R; import com.example.mynotepad.R;
import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -90,7 +90,7 @@ public class AudioListFragment extends Fragment { ...@@ -90,7 +90,7 @@ public class AudioListFragment extends Fragment {
bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { bottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
@Override @Override
public void onStateChanged(@NonNull View bottomSheet, int newState) { 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 bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);// in the first position that it used to be
} }
} }
...@@ -105,6 +105,7 @@ public class AudioListFragment extends Fragment { ...@@ -105,6 +105,7 @@ public class AudioListFragment extends Fragment {
private void addListener() { private void addListener() {
recordingAdapter.setOnVoiceMassageClickListener(new OnVoiceMassageClickListener() { recordingAdapter.setOnVoiceMassageClickListener(new OnVoiceMassageClickListener() {
@Override @Override
public void onItemLongClicked(MyVoice item) { public void onItemLongClicked(MyVoice item) {
customToolbarOption.setVisibility(View.VISIBLE); customToolbarOption.setVisibility(View.VISIBLE);
...@@ -138,7 +139,7 @@ public class AudioListFragment extends Fragment { ...@@ -138,7 +139,7 @@ public class AudioListFragment extends Fragment {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
myVoiceArrayList.remove(myChosenVoice); myVoiceArrayList.remove(myChosenVoice);
System.out.println(myChosenVoice.getFileName() +" "+myChosenVoice.getUri() ); System.out.println(myChosenVoice.getFileName() + " " + myChosenVoice.getUri());
new File(myChosenVoice.getFileName()).delete(); new File(myChosenVoice.getFileName()).delete();
customToolbarOption.setVisibility(View.GONE); customToolbarOption.setVisibility(View.GONE);
recyclerViewRecordings.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); recyclerViewRecordings.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
......
package com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView; package com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView;
import java.util.Date; import java.util.Date;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class TimeAgo { public class TimeAgo {
Date now = new Date(); 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);
long minutes = TimeUnit.MINUTES.toMinutes(now.getTime() - duration); long minutes = TimeUnit.MINUTES.toMinutes(now.getTime() - duration);
long hours = TimeUnit.HOURS.toHours(now.getTime() - duration); long hours = TimeUnit.HOURS.toHours(now.getTime() - duration);
long days = TimeUnit.DAYS.toDays(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 ...@@ -61,16 +61,16 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
holder.imageViewStop.setVisibility(View.VISIBLE); holder.imageViewStop.setVisibility(View.VISIBLE);
holder.imageViewPlay.setVisibility(View.GONE); holder.imageViewPlay.setVisibility(View.GONE);
TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView); TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView);
holder.seekBar.setVisibility(View.VISIBLE); // holder.seekBar.setVisibility(View.VISIBLE);
holder.seekUpdation(holder); // holder.seekUpdation(holder);
} else { } else {
holder.imageViewStop.setVisibility(View.GONE); holder.imageViewStop.setVisibility(View.GONE);
holder.imageViewPlay.setVisibility(View.VISIBLE); holder.imageViewPlay.setVisibility(View.VISIBLE);
TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView); 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 ...@@ -86,7 +86,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
class VoiceViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener { class VoiceViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener {
FrameLayout startStopBtn; FrameLayout startStopBtn;
ImageView imageViewPlay, imageViewStop; ImageView imageViewPlay, imageViewStop;
SeekBar seekBar; // SeekBar seekBar;
TextView textViewName; TextView textViewName;
private String recordingUri; private String recordingUri;
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
...@@ -97,7 +97,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol ...@@ -97,7 +97,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
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); // seekBar = itemView.findViewById(R.id.seekBar);
textViewName = itemView.findViewById(R.id.voiceName); textViewName = itemView.findViewById(R.id.voiceName);
startStopBtn = itemView.findViewById(R.id.start_stopBtn); startStopBtn = itemView.findViewById(R.id.start_stopBtn);
imageViewStop.setVisibility(View.GONE); imageViewStop.setVisibility(View.GONE);
...@@ -144,7 +144,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol ...@@ -144,7 +144,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
else { else {
startPlaying(myVoice, position); startPlaying(myVoice, position);
myVoice.setPlaying(true); myVoice.setPlaying(true);
seekBar.setMax(mPlayer.getDuration()); // seekBar.setMax(mPlayer.getDuration());
Log.d("isPlayin", "False"); Log.d("isPlayin", "False");
} }
notifyItemChanged(position); notifyItemChanged(position);
...@@ -156,7 +156,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol ...@@ -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() { holder.seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
...@@ -192,7 +192,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol ...@@ -192,7 +192,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol
holder.seekBar.setProgress(mCurrentPosition); holder.seekBar.setProgress(mCurrentPosition);
} }
mHandler.postDelayed(runnable, 100); mHandler.postDelayed(runnable, 100);
} }*/
private void stopPlaying() { private void stopPlaying() {
try { try {
...@@ -214,7 +214,7 @@ public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHol ...@@ -214,7 +214,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() {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<ImageView <ImageView
android:id="@+id/pauseImg" android:id="@+id/pauseImg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="37dp" android:layout_height="match_parent"
android:src="@drawable/pause" /> android:src="@drawable/pause" />
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
...@@ -46,20 +46,12 @@ ...@@ -46,20 +46,12 @@
android:id="@+id/voiceTime" android:id="@+id/voiceTime"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="2"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:textSize="8dp" android:textSize="12dp"
android:text="time" android:text="time"
android:gravity="center_vertical" android:gravity="top"
android:layout_marginLeft="10dp" /> 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> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_sheet" android:id="@+id/player_sheet"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
...@@ -15,12 +15,13 @@ ...@@ -15,12 +15,13 @@
android:id="@+id/linearLayout" android:id="@+id/linearLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="60dp" android:layout_height="60dp"
android:layout_marginTop="10dp" android:layout_marginTop="17dp"
android:background="@drawable/media_header_bg" android:background="@drawable/media_header_bg"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteY="4dp"> app:layout_constraintTop_toTopOf="parent"
tools:ignore="MissingConstraints">
<ImageView <ImageView
...@@ -37,12 +38,12 @@ ...@@ -37,12 +38,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="3" android:layout_weight="3"
android:gravity="center_vertical"
android:paddingLeft="10dp" android:paddingLeft="10dp"
android:paddingTop="10dp" android:paddingTop="10dp"
android:paddingBottom="10dp" android:paddingBottom="10dp"
android:text="@string/media_player" android:text="@string/media_player"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:gravity="center_vertical"
android:textSize="20dp" /> android:textSize="20dp" />
<TextView <TextView
...@@ -61,21 +62,30 @@ ...@@ -61,21 +62,30 @@
android:textSize="20dp" android:textSize="20dp"
tools:ignore="RtlCompat" /> tools:ignore="RtlCompat" />
</LinearLayout> </LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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 <TextView
android:id="@+id/textView3" android:id="@+id/textView3"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:text="@string/file_name" android:text="@string/file_name"
android:textAlignment="center" android:textAlignment="center"
android:textColor="@color/white"
android:textSize="16dp"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
android:textSize="16dp" app:layout_constraintTop_toTopOf="parent"
android:gravity="center_horizontal"
android:textColor="@color/white"
tools:ignore="MissingConstraints" /> tools:ignore="MissingConstraints" />
<ImageButton <ImageButton
...@@ -96,12 +106,12 @@ ...@@ -96,12 +106,12 @@
android:id="@+id/imageView11" android:id="@+id/imageView11"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#0035438C"
app:layout_constraintBottom_toBottomOf="@+id/player_play_btn" app:layout_constraintBottom_toBottomOf="@+id/player_play_btn"
app:layout_constraintEnd_toStartOf="@+id/player_play_btn" app:layout_constraintEnd_toStartOf="@+id/player_play_btn"
app:layout_constraintHorizontal_bias="0.519" app:layout_constraintHorizontal_bias="0.519"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/player_play_btn" app:layout_constraintTop_toTopOf="@+id/player_play_btn"
android:background="#0035438C"
app:layout_constraintVertical_bias="0.545" app:layout_constraintVertical_bias="0.545"
app:srcCompat="@android:drawable/ic_media_rew" /> app:srcCompat="@android:drawable/ic_media_rew" />
...@@ -109,11 +119,11 @@ ...@@ -109,11 +119,11 @@
android:id="@+id/imageView12" android:id="@+id/imageView12"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="#0035438C"
app:layout_constraintBottom_toBottomOf="@+id/player_play_btn" app:layout_constraintBottom_toBottomOf="@+id/player_play_btn"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/player_play_btn" app:layout_constraintStart_toEndOf="@+id/player_play_btn"
app:layout_constraintTop_toTopOf="@+id/player_play_btn" app:layout_constraintTop_toTopOf="@+id/player_play_btn"
android:background="#0035438C"
app:srcCompat="@android:drawable/ic_media_ff" /> app:srcCompat="@android:drawable/ic_media_ff" />
<SeekBar <SeekBar
...@@ -127,6 +137,6 @@ ...@@ -127,6 +137,6 @@
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/player_play_btn" /> app:layout_constraintTop_toBottomOf="@+id/player_play_btn" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file \ 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