Commit c7d4b10e authored by 9731301's avatar 9731301

debug delete voices

parent 618fc2ca
...@@ -43,6 +43,7 @@ public class AudioListFragment extends Fragment { ...@@ -43,6 +43,7 @@ public class AudioListFragment extends Fragment {
private ImageButton playerPlayBtn; private ImageButton playerPlayBtn;
private TextView fileNameTv , headerTitleTv; private TextView fileNameTv , headerTitleTv;
private SeekBar seekBar; private SeekBar seekBar;
private File[] files;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
...@@ -81,7 +82,7 @@ public class AudioListFragment extends Fragment { ...@@ -81,7 +82,7 @@ public class AudioListFragment extends Fragment {
String path = root.getAbsolutePath() + "/NotepadVoiceRecorder/Audios"; String path = root.getAbsolutePath() + "/NotepadVoiceRecorder/Audios";
Log.d("Files", "Path: " + path); Log.d("Files", "Path: " + path);
File directory = new File(path); File directory = new File(path);
File[] files = directory.listFiles(); files = directory.listFiles();
if (files != null) { if (files != null) {
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();
...@@ -146,9 +147,15 @@ public class AudioListFragment extends Fragment { ...@@ -146,9 +147,15 @@ public class AudioListFragment extends Fragment {
alert.setPositiveButton("yes", new DialogInterface.OnClickListener() { alert.setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
myVoiceArrayList.remove(myChosenVoice); if (files!= null){
System.out.println(myChosenVoice.getFileName() + " " + myChosenVoice.getUri()); for (int j = 0 ; j < files.length ; j++){
new File(myChosenVoice.getFileName()).delete(); if (files[j].getAbsolutePath().equals(myChosenVoice.getUri())){
files[j].delete();
myVoiceArrayList.remove(myChosenVoice);
}
}
}
customToolbarOption.setVisibility(View.GONE); customToolbarOption.setVisibility(View.GONE);
recyclerViewRecordings.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false)); recyclerViewRecordings.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
recyclerViewRecordings.setHasFixedSize(true); recyclerViewRecordings.setHasFixedSize(true);
......
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