Commit 91785dd1 authored by 9731301's avatar 9731301

add voiceMassages

parent ffa0cd7d
......@@ -2,6 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mynotepad">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
......@@ -12,7 +15,7 @@
<activity android:name=".MenuFeatures.VoiceMassages.RecorderActivity"></activity>
<activity android:name=".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity" />
<activity android:name=".MenuFeatures.Calender.MyCalenderActivity" />
<activity android:name=".MenuFeatures.VoiceMassages.VoiceMassages" />
<activity android:name=".MenuFeatures.VoiceMassages.VoiceMassagesActivity" />
<activity android:name=".MenuFeatures.AllNotes.AllNotesActivity" />
<activity android:name=".MenuFeatures.AllAchievedNotes.AchivedNotesActivity" />
<activity android:name=".MenuFeatures.Setting.SettingActivity" />
......
......@@ -3,6 +3,7 @@ package com.example.mynotepad;
import androidx.appcompat.app.AppCompatActivity;
import androidx.room.Room;
import android.animation.ObjectAnimator;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
......@@ -10,7 +11,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import com.example.mynotepad.Menu.CustomMenu;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.NoteDataBase;
import com.example.mynotepad.MenuFeatures.AllNotes.DataBase.NoteDataBase;
import com.example.mynotepad.MenuFeatures.Information.InfoClickListener;
import com.example.mynotepad.MenuFeatures.Information.Information;
......@@ -21,6 +22,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private TextView wlcTxt;
private Information informationView;
public static NoteDataBase noteDataBase;
private ObjectAnimator objectAnimator;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -52,10 +54,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
findViewById(R.id.main).setOnClickListener(this);
customMenu.setOnClickListener(this);
objectAnimator = ObjectAnimator.ofFloat(customMenu , "x" , 400);
customMenu.setInfoClickListener(new InfoClickListener() {
@Override
public void onInfoTvClicked(TextView infoTv) {
informationView.setVisibility(View.VISIBLE);
}
});
}
......@@ -64,6 +68,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
public void onClick(View view) {
if (view.getId() == toolbarListImg.getId() || customMenu.getId() == view.getId()) {
objectAnimator.setDuration(2000);
objectAnimator.start();
customMenu.setVisibility(customMenu.VISIBLE);
informationView.setVisibility(View.GONE);
} else if (R.id.main == view.getId()) {
......
......@@ -13,7 +13,7 @@ import com.example.mynotepad.MenuFeatures.AllNotes.AllNotesActivity;
import com.example.mynotepad.MenuFeatures.Calender.MyCalenderActivity;
import com.example.mynotepad.MenuFeatures.Information.InfoClickListener;
import com.example.mynotepad.MenuFeatures.Setting.SettingActivity;
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassages;
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesActivity;
import com.example.mynotepad.R;
import com.google.android.material.snackbar.Snackbar;
......@@ -73,7 +73,7 @@ public class CustomMenu extends LinearLayout implements View.OnClickListener {
}
private void showVoiceMassages() {
Intent intent = new Intent(getContext(), VoiceMassages.class);
Intent intent = new Intent(getContext(), VoiceMassagesActivity.class);
getContext().startActivity(intent);
}
......
......@@ -5,7 +5,6 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.room.Room;
import android.app.AlertDialog;
import android.content.DialogInterface;
......@@ -15,13 +14,11 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.example.mynotepad.MainActivity;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyAllNotesAdaptor;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.OnAllNotesItemClickListener;
import com.example.mynotepad.MenuFeatures.AllNotes.Note.NoteFragment;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.Note;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.NoteDataBase;
import com.example.mynotepad.MenuFeatures.AllNotes.DataBase.Note;
import com.example.mynotepad.MenuFeatures.CustomToolbarOption;
import com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener;
import com.example.mynotepad.R;
......@@ -45,8 +42,7 @@ public class AllNotesActivity extends AppCompatActivity {
private MyAllNotesAdaptor myAdaptor;
private List<Note> entityNotes;
private List<MyNote> myNotes;
public static MyNote myChosenNote;
public static HashMap<MyNote , Note> myNoteNoteHashMap;
private static MyNote myChosenNote;
......@@ -58,7 +54,7 @@ public class AllNotesActivity extends AppCompatActivity {
}
private void init() {
// get data from databas
// get data from database
setAllNoteListAndTitles();
customToolbarOption = findViewById(R.id.customToolbarOption);
......@@ -213,13 +209,11 @@ public class AllNotesActivity extends AppCompatActivity {
private void setAllNoteListAndTitles() {
myNoteNoteHashMap = new HashMap<>();
entityNotes = noteDataBase.noteDao().getAll();
myNotes = new ArrayList<>();
for (Note note : entityNotes) {
MyNote myNote = new MyNote(note.getTitle(), note.getDescription(), note.isAchieved());
myNotes.add(myNote);
myNoteNoteHashMap.put(myNote , note);
}
}
......
package com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase;
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
......
package com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase;
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.Dao;
import androidx.room.Delete;
......
package com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase;
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.ColumnInfo;
import androidx.room.Entity;
......
package com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase;
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.Dao;
import androidx.room.Delete;
......@@ -22,8 +22,9 @@ public interface NoteDAO {
@Delete
void deleteNote(Note myNote);
@Update
void updateNote(Note note);
@Query("UPDATE Note SET title = :title , description = :description ,achieved = :isAchieved Where ID = :id")
void updateNote(String title , String description , boolean isAchieved , int id);
}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase;
package com.example.mynotepad.MenuFeatures.AllNotes.DataBase;
import androidx.room.Database;
import androidx.room.RoomDatabase;
......
......@@ -15,7 +15,7 @@ import android.widget.EditText;
import android.widget.Toast;
import com.example.mynotepad.MenuFeatures.AllNotes.AllNotesActivity;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.Note;
import com.example.mynotepad.MenuFeatures.AllNotes.DataBase.Note;
import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
......@@ -95,8 +95,7 @@ public class NoteFragment extends Fragment {
noteDataBase.noteDao().insertNote(note);
Toast.makeText(getActivity(), "saved", Toast.LENGTH_SHORT).show();
}else {
note = AllNotesActivity.myNoteNoteHashMap.get(AllNotesActivity.myChosenNote);
noteDataBase.noteDao().updateNote(note);
noteDataBase.noteDao().updateNote(titleTxt.getText().toString() , bodyTxt.getText().toString() , note.isAchieved() , note.getID());
Toast.makeText(getActivity(), "updated", Toast.LENGTH_SHORT).show();
}
}
......
......@@ -13,8 +13,8 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.example.mynotepad.MenuFeatures.AllNotes.DataBase.DateEntity;
import com.example.mynotepad.MenuFeatures.AllNotes.Note.NoteFragment;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.DateEntity;
import com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.MyCalenderAdaptor;
import com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.OnCalenderItemClickListener;
import com.example.mynotepad.MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity;
......@@ -32,15 +32,15 @@ import static com.example.mynotepad.MainActivity.noteDataBase;
public class MyCalenderActivity extends AppCompatActivity {
private FloatingActionButton addDateBtn;
private CustomToolbarOption customToolbarOption;
private FrameLayout calenderToolbar;
private LinearLayout allDateListAndTitle;
private FrameLayout fragPlace;
private RecyclerView recyclerView;
private MyCalenderAdaptor myAdaptor;
private List<MyDate> myDates;
private List<DateEntity> entityDates;
private FloatingActionButton addDateBtn;
private CustomToolbarOption customToolbarOption;
private FrameLayout calenderToolbar;
private LinearLayout allDateListAndTitle;
private FrameLayout fragPlace;
private RecyclerView recyclerView;
private MyCalenderAdaptor myAdaptor;
private List<MyDate> myDates;
private List<DateEntity> entityDates;
private MyDate myChosenDateNote;
@Override
......
......@@ -12,9 +12,8 @@ import android.widget.Toast;
import com.alirezaafkar.sundatepicker.DatePicker;
import com.alirezaafkar.sundatepicker.interfaces.DateSetListener;
import com.example.mynotepad.MenuFeatures.AllNotes.AllNotesActivity;
import com.example.mynotepad.MenuFeatures.Calender.Date;
import com.example.mynotepad.MenuFeatures.AllNotes.NotesDataBase.DateEntity;
import com.example.mynotepad.MenuFeatures.AllNotes.DataBase.DateEntity;
import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
......
package com.example.mynotepad.MenuFeatures.VoiceMassages;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import android.Manifest;
import android.content.pm.PackageManager;
import android.media.MediaPlayer;
import android.media.MediaRecorder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
import android.transition.TransitionManager;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.Toast;
import com.example.mynotepad.R;
public class RecorderActivity extends AppCompatActivity {
import java.io.File;
import java.io.IOException;
public class RecorderActivity extends AppCompatActivity implements View.OnClickListener {
private Button start_stopBtn;
private ImageView imageViewPlayPause;
private SeekBar seekBar;
private boolean isRecording = false, isPlaying = false;
private Chronometer chronometer;
private LinearLayout linearLayoutRecorder;
private MediaRecorder mRecorder;
private MediaPlayer mPlayer;
private int RECORD_AUDIO_REQUEST_CODE = 123;
private String fileName = null;
private int lastProgress = 0;
private Handler mHandler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recorder);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
getPermissionToRecordAudio();
}
init();
}
@RequiresApi(api = Build.VERSION_CODES.M)
public void getPermissionToRecordAudio() {
if (ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|| ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE},
RECORD_AUDIO_REQUEST_CODE);
}
}
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
if (requestCode == RECORD_AUDIO_REQUEST_CODE) {
if (grantResults.length == 3 && grantResults[0] == PackageManager.PERMISSION_GRANTED && grantResults[1] == PackageManager.PERMISSION_GRANTED && grantResults[2] == PackageManager.PERMISSION_GRANTED) {
Toast.makeText(this, "accepted", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(this, "You must give permissions to use this app. App is exiting.", Toast.LENGTH_SHORT).show();
finishAffinity();
}
}
}
private void init() {
start_stopBtn = findViewById(R.id.start_stopBtn);
seekBar = findViewById(R.id.seekBar);
imageViewPlayPause = findViewById(R.id.play_pause);
imageViewPlayPause.setImageResource(R.drawable.pause);
chronometer = findViewById(R.id.chronometerTimer);
chronometer.setBase(SystemClock.elapsedRealtime());
linearLayoutRecorder = findViewById(R.id.linearLayoutRecorder);
start_stopBtn.setOnClickListener(this);
imageViewPlayPause.setOnClickListener(this);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onClick(View view) {
if (start_stopBtn.getId() == view.getId()) {
if (isRecording) {
isRecording = false;
prepareForStopRecording();
stopRecording();
} else {
isRecording = true;
prepareforRecording();
startRecording();
}
} else if (view.getId() == imageViewPlayPause.getId()) {
if (isPlaying) {
isPlaying = false;
stopPlaying();
} else {
isPlaying = true;
startPlaying();
}
}
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void prepareForStopRecording() {
TransitionManager.beginDelayedTransition(linearLayoutRecorder);
start_stopBtn.setBackground(getResources().getDrawable( R.drawable.start_stop_bg));
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void prepareforRecording() {
TransitionManager.beginDelayedTransition(linearLayoutRecorder);
start_stopBtn.setBackground(getResources().getDrawable( R.drawable.stop_btn_bg));
}
private void startRecording() {
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
File root = android.os.Environment.getExternalStorageDirectory();
File file = new File(root.getAbsolutePath() + "/VoiceRecorderSimplifiedCoding/Audios");
if (!file.exists()) {
file.mkdirs();//create a file if it does not exists
}
fileName = root.getAbsolutePath() + "/VoiceRecorderSimplifiedCoding/Audios/" + String.valueOf(System.currentTimeMillis() + ".mp3");
Log.d("filename", fileName);
mRecorder.setOutputFile(fileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
mRecorder.prepare();
mRecorder.start();
} catch (IOException e) {
e.printStackTrace();
}
lastProgress = 0;
seekBar.setProgress(0);
stopPlaying();
// making the imageview a stop button
//starting the chronometer
chronometer.setBase(SystemClock.elapsedRealtime());
chronometer.start();
}
private void stopRecording() {
try {
mRecorder.stop();
mRecorder.release();
} catch (Exception e) {
e.printStackTrace();
}
mRecorder = null;
chronometer.stop();
chronometer.setBase(SystemClock.elapsedRealtime());
Toast.makeText(this, "Recording saved successfully.", Toast.LENGTH_SHORT).show();
}
}
\ No newline at end of file
private void stopPlaying() {
try {
mPlayer.release();
} catch (Exception e) {
e.printStackTrace();
}
mPlayer = null;
imageViewPlayPause.setImageResource(R.drawable.play);
chronometer.stop();
}
private void startPlaying() {
mPlayer = new MediaPlayer();
try {
mPlayer.setDataSource(fileName);
mPlayer.prepare();
mPlayer.start();
} catch (IOException e) {
Log.e("LOG_TAG", "prepare() failed");
}
imageViewPlayPause.setImageResource(R.drawable.pause);
//set seekBar
seekBar.setProgress(lastProgress);
mPlayer.seekTo(lastProgress);
seekBar.setMax(mPlayer.getDuration());
seekUpdation();
chronometer.start();
//startPlaying
mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
imageViewPlayPause.setImageResource(R.drawable.play);
isPlaying = false;
chronometer.stop();
}
});
seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (mPlayer != null && fromUser) {
mPlayer.seekTo(progress);
chronometer.setBase(SystemClock.elapsedRealtime() - mPlayer.getCurrentPosition());
lastProgress = progress;
}
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
}
private void seekUpdation() {
if (mPlayer != null) {
int mCurrentPosition = mPlayer.getCurrentPosition();
seekBar.setProgress(mCurrentPosition);
lastProgress = mCurrentPosition;
}
mHandler.postDelayed(runnable, 100);
}
Runnable runnable = new Runnable() {
@Override
public void run() {
seekUpdation();
}
};
}
/* private void initViews() {
imageViewRecord = (ImageView) findViewById(R.id.imageViewRecord);
imageViewStop = (ImageView) findViewById(R.id.imageViewStop);
imageViewPlay = (ImageView) findViewById(R.id.imageViewPlay);
linearLayoutPlay = (LinearLayout) findViewById(R.id.linearLayoutPlay);
seekBar = (SeekBar) findViewById(R.id.seekBar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.list_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.item_list:
gotoRecodingListActivity();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void gotoRecodingListActivity() {
Intent intent = new Intent(this, RecordingListActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}*/
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.VoiceMassages;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
public class VoiceMassages extends AppCompatActivity {
private FloatingActionButton allVoiceBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voice_massages);
init();
}
private void init() {
allVoiceBtn = findViewById(R.id.addVoiceButton);
addListener();
}
private void addListener() {
allVoiceBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(VoiceMassages.this , RecorderActivity.class);
startActivity(intent);
}
});
}
}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.VoiceMassages;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import com.example.mynotepad.MenuFeatures.AllNotes.AllNotesActivity;
import com.example.mynotepad.MenuFeatures.CustomToolbarOption;
import com.example.mynotepad.MenuFeatures.CustomToolbarOptionListener;
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.MyVoice;
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.OnVoiceMassageClickListener;
import com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView.VoiceAdaptor;
import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.io.File;
import java.util.ArrayList;
import static com.example.mynotepad.MainActivity.noteDataBase;
public class VoiceMassagesActivity extends AppCompatActivity {
private FloatingActionButton allVoiceBtn;
private RecyclerView recyclerViewRecordings;
private VoiceAdaptor recordingAdapter;
private ArrayList<MyVoice> myVoiceArrayList;
private CustomToolbarOption customToolbarOption;
private MyVoice myChosenVoice;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_voice_massages);
init();
fetchRecordings();
addListener();
}
/* @Override
protected void onResume() {
super.onResume();
init();
}*/
private void init() {
customToolbarOption = findViewById(R.id.customToolbarOption);
customToolbarOption.setVisibility(View.GONE);
myVoiceArrayList = new ArrayList<>();
allVoiceBtn = findViewById(R.id.addVoiceButton);
/** enabling back button ***/
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/** setting up recyclerView **/
recyclerViewRecordings = findViewById(R.id.recyclerView);
recyclerViewRecordings.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
recyclerViewRecordings.setHasFixedSize(true);
}
private void fetchRecordings() {
File root = android.os.Environment.getExternalStorageDirectory();
String path = root.getAbsolutePath() + "/VoiceRecorderSimplifiedCoding/Audios";
Log.d("Files", "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
// Log.d("Files", "Size: " + files.length);
if (files != null) {
for (int i = 0; i < files.length; i++) {
Log.d("Files", "FileName:" + files[i].getName());
String fileName = files[i].getName();
String recordingUri = root.getAbsolutePath() + "/VoiceRecorderSimplifiedCoding/Audios/" + fileName;
MyVoice myVoice = new MyVoice(recordingUri, fileName, false);
myVoiceArrayList.add(myVoice);
}
}
recordingAdapter = new VoiceAdaptor(this, myVoiceArrayList);
recyclerViewRecordings.setAdapter(recordingAdapter);
}
private void addListener() {
allVoiceBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(VoiceMassagesActivity.this, RecorderActivity.class);
startActivity(intent);
}
});
recordingAdapter.setOnVoiceMassageClickListener(new OnVoiceMassageClickListener() {
@Override
public void onItemLongClicked(MyVoice item) {
customToolbarOption.setVisibility(View.VISIBLE);
myChosenVoice = item;
}
});
//add listener to custom toolbar option and set being achieved or not to be saved in database
customToolbarOption.setCustomToolbarOptionListener(new CustomToolbarOptionListener() {
@Override
public void onStarClicked(ImageView yellowS, ImageView blackS) {
}
@Override
public void onDeleteClicked(final ImageView imageView) {
deleteClicked(imageView);
}
@Override
public void onCloseClicked() {
customToolbarOption.setVisibility(View.GONE);
}
});
}
private void deleteClicked(ImageView imageView) {
AlertDialog.Builder alert = new AlertDialog.Builder(VoiceMassagesActivity.this);
alert.setMessage("are you sure you wanna delete it ??? ");
alert.setPositiveButton("yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
myVoiceArrayList.remove(myChosenVoice);
System.out.println(myChosenVoice.getFileName() +" "+myChosenVoice.getUri() );
new File(myChosenVoice.getFileName()).delete();
init();
fetchRecordings();
addListener();
}
});
alert.setNegativeButton("no", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
alert.show();
}
}
package com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView;
public class MyVoice {
String Uri, fileName;
boolean isPlaying = false;
public MyVoice(String uri, String fileName, boolean isPlaying) {
Uri = uri;
this.fileName = fileName;
this.isPlaying = isPlaying;
}
public String getUri() {
return Uri;
}
public String getFileName() {
return fileName;
}
public boolean isPlaying() {
return isPlaying;
}
public void setPlaying(boolean playing) {
this.isPlaying = playing;
}
}
package com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote;
public interface OnVoiceMassageClickListener {
void onItemLongClicked(MyVoice item);
}
package com.example.mynotepad.MenuFeatures.VoiceMassages.VoiceMassagesRecyclerView;
import android.content.Context;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Handler;
import android.transition.TransitionManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;
import com.example.mynotepad.R;
import java.io.IOException;
import java.util.ArrayList;
public class VoiceAdaptor extends RecyclerView.Adapter<VoiceAdaptor.VoiceViewHolder> {
private Context context;
private ArrayList<MyVoice> myVoiceArrayList;
private MediaPlayer mPlayer;
private boolean isPlaying = false;
private int last_index = -1;
private OnVoiceMassageClickListener onVoiceMassageClickListener;
public VoiceAdaptor(Context context, ArrayList<MyVoice> myVoiceArrayList) {
this.context = context;
this.myVoiceArrayList = myVoiceArrayList;
}
@NonNull
@Override
public VoiceViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.custom_voice_item, parent, false);
return new VoiceViewHolder(view);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public void onBindViewHolder(@NonNull VoiceViewHolder holder, int position) {
setUpData(holder, position);
}
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
private void setUpData(VoiceViewHolder holder, int position) {
MyVoice myVoice = myVoiceArrayList.get(position);
holder.textViewName.setText(myVoice.getFileName());
if (myVoice.isPlaying()) {
holder.imageViewStop.setVisibility(View.VISIBLE);
holder.imageViewPlay.setVisibility(View.GONE);
TransitionManager.beginDelayedTransition((ViewGroup) holder.itemView);
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.manageSeekBar(holder);
}
@Override
public int getItemCount() {
return myVoiceArrayList.size();
}
public void setOnVoiceMassageClickListener(OnVoiceMassageClickListener onVoiceMassageClickListener) {
this.onVoiceMassageClickListener = onVoiceMassageClickListener;
}
class VoiceViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener {
FrameLayout startStopBtn;
ImageView imageViewPlay, imageViewStop;
SeekBar seekBar;
TextView textViewName;
private String recordingUri;
private Handler mHandler = new Handler();
VoiceViewHolder holder;
public VoiceViewHolder(View itemView) {
super(itemView);
imageViewPlay = itemView.findViewById(R.id.playImg);
imageViewStop = itemView.findViewById(R.id.pauseImg);
seekBar = itemView.findViewById(R.id.seekBar);
textViewName = itemView.findViewById(R.id.voiceName);
startStopBtn = itemView.findViewById(R.id.start_stopBtn);
imageViewStop.setVisibility(View.GONE);
itemView.setOnLongClickListener(this);
/*
add clickListener to stop or start playing
*/
startStopBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int position = getAdapterPosition();
MyVoice myVoice = myVoiceArrayList.get(position);
recordingUri = myVoice.getUri();
//if media player is playing
if (isPlaying) {
stopPlaying();
//if another clicked item (your last chosen item) is playing and you click on it again to stop it
if (position == last_index) {
myVoice.setPlaying(false);
stopPlaying();
notifyItemChanged(position);
}
// if you click on another item while your last one(your last chosen item) is playing
else {
markAllPaused();
myVoice.setPlaying(true);
notifyItemChanged(position);
startPlaying(myVoice, position);
last_index = position;// set the last playing item on the one which is playing
}
}
//if media player is not playing
else {
//if clicked item is playing it is wrong so it should be stopped
if (myVoice.isPlaying()) {
myVoice.setPlaying(false);
stopPlaying();
Log.d("isPlayin", "True");
}
//if nothing is playing and you want to play a new voice massage
else {
startPlaying(myVoice, position);
myVoice.setPlaying(true);
seekBar.setMax(mPlayer.getDuration());
Log.d("isPlayin", "False");
}
notifyItemChanged(position);
last_index = position;// set the last playing item on the one which is playing
}
}
});
}
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() {
try {
mPlayer.release();
} catch (Exception e) {
e.printStackTrace();
}
mPlayer = null;
isPlaying = false;
}
private void startPlaying(final MyVoice audio, final int position) {
mPlayer = new MediaPlayer();
try {
mPlayer.setDataSource(recordingUri);
mPlayer.prepare();
mPlayer.start();
} catch (IOException e) {
Log.e("LOG_TAG", "prepare() failed");
}
//showing the pause button
seekBar.setMax(mPlayer.getDuration());
isPlaying = true;
mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
audio.setPlaying(false);
notifyItemChanged(position);
}
});
}
@Override
public boolean onLongClick(View view) {
if (onVoiceMassageClickListener != null)
onVoiceMassageClickListener.onItemLongClicked(myVoiceArrayList.get(getAdapterPosition()));
return true;
}
}
/*
* set all voice items on pause and stop all of them
*/
private void markAllPaused() {
for (int i = 0; i < myVoiceArrayList.size(); i++) {
myVoiceArrayList.get(i).setPlaying(false);
myVoiceArrayList.set(i, myVoiceArrayList.get(i));
}
notifyDataSetChanged();
}
}
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z"/>
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ABE60C25"/>
<stroke
android:width="10dp"
android:color="#F0A84F4F"/>
<corners android:radius="0dp"/>
</shape>
\ No newline at end of file
......@@ -54,25 +54,34 @@
android:layout_width="wrap_content"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addNoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:layout_marginTop="480dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addNoteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:layout_marginRight="30dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp"
android:layout_alignParentEnd="true"
android:focusable="true" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -73,18 +73,24 @@
android:layout_width="260dp"
android:layout_height="match_parent"
android:layout_marginLeft="20dp"
android:gravity="top"
android:lines="9"
android:textColor="#000000" />
android:textColor="#000000"
android:layout_marginStart="20dp" />
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/calenderBackBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:layout_marginTop="520dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:src="@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint="#DF4141" />
app:backgroundTint="#DF4141"
android:layout_marginEnd="30dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
\ No newline at end of file
......@@ -35,7 +35,7 @@
android:layout_marginTop="-6dp"
android:layout_marginEnd="-2dp"
android:layout_marginRight="-2dp"
android:background="#4883B5DD">
android:background="@drawable/simple_color">
<ImageView
android:id="@+id/imageView"
......
......@@ -55,25 +55,32 @@
android:layout_width="wrap_content"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/calenderRecyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/calenderRecyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addDateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:layout_marginTop="480dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addDateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
......@@ -15,6 +15,35 @@
android:scaleType="fitXY"
app:srcCompat="@drawable/index" />
<LinearLayout
android:id="@+id/linearLayoutRecorder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:orientation="vertical">
<Chronometer
android:id="@+id/chronometerTimer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textColor="#016D91"
android:textSize="60sp" />
<SeekBar
android:id="@+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="20dp"
android:layout_weight="1"
android:thumb="@android:drawable/presence_invisible" />
</LinearLayout>
<Button
android:id="@+id/start_stopBtn"
android:layout_width="50dp"
......@@ -24,26 +53,17 @@
android:layout_marginBottom="50dp"
android:background="@drawable/start_stop_bg" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView
android:id="@+id/play_pause"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignBottom="@id/start_stopBtn"
android:layout_marginRight="30dp"
android:layout_toLeftOf="@id/start_stopBtn">
android:layout_toLeftOf="@id/start_stopBtn"
android:src="@drawable/play" />
<ImageView
android:id="@+id/play"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/play"/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/pause"/>
</FrameLayout>
<FrameLayout
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/start_stopBtn"
......@@ -54,8 +74,7 @@
android:id="@+id/saveVoice"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/square"
/>
</FrameLayout>
android:src="@drawable/square" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MenuFeatures.VoiceMassages.VoiceMassages">
tools:context=".MenuFeatures.VoiceMassages.VoiceMassagesActivity">
<FrameLayout
......@@ -29,7 +29,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:enabled="false"
android:text="@string/all_notes"
android:text="all voice massages"
android:textColor="#02091E"
android:textSize="26dp" />
......@@ -45,24 +45,31 @@
android:layout_width="wrap_content"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="409dp"
android:layout_height="match_parent"
android:background="#4883B5DD"
tools:layout_editor_absoluteX="1dp"
tools:layout_editor_absoluteY="1dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addVoiceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:layout_marginTop="480dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/addVoiceButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:clickable="true"
android:src="@drawable/add"
app:backgroundTint="#5266D5"
tools:layout_editor_absoluteX="310dp"
tools:layout_editor_absoluteY="612dp" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
......@@ -11,6 +11,7 @@
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:text="title"
android:textColor="#000A43"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/row_bg"
android:orientation="vertical">
android:layout_height="80dp"
android:background="@drawable/row_bg">
<FrameLayout
android:id="@+id/start_stopBtn"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp">
<Button
android:layout_marginRight="20dp"
android:layout_centerVertical="true"
android:background="@drawable/start_stop_bg">
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/start_stop_bg" />
<ImageView
android:id="@+id/playImg"
android:layout_width="match_parent"
......@@ -26,17 +22,32 @@
<ImageView
android:id="@+id/pauseImg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/pause"/>
android:layout_height="37dp"
android:src="@drawable/pause" />
</FrameLayout>
<TextView
android:id="@+id/voiceName"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/start_stopBtn"
android:orientation="vertical">
<TextView
android:id="@+id/voiceName"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_marginRight="10dp"
android:textSize="20dp"
android:textSize="18dp"
android:text="fdsgrgr"
android:gravity="center_vertical"
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 xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
......@@ -8,44 +8,62 @@
android:orientation="vertical">
<EditText
android:id="@+id/myTitle"
<RelativeLayout
android:id="@+id/myTitleParent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="50dp"
android:hint=" title"
android:textSize="24dp"
android:background="@drawable/title_background"/>
android:layout_marginTop="5dp"
android:layout_marginRight="10dp"
android:background="@drawable/title_background">
<EditText
android:id="@+id/myTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint=" title"
android:textSize="24dp" />
</RelativeLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:id="@+id/myTitleParent2"
android:layout_below="@id/myTitleParent">
<EditText
android:id="@+id/textBody"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignTop="@+id/title"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/myTitleParent"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="3dp"
android:layout_marginBottom="10dp"
android:background="@drawable/description_backgroung"
android:gravity="top"
android:hint=" ..."
android:lines="20" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:layout_marginTop="480dp"
android:src="@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint="#DF4141" />
android:gravity="top">
<EditText
android:id="@+id/textBody"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="top"
android:hint="@string/dots"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/backBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="30dp"
android:layout_marginBottom="30dp"
android:src="@drawable/ic_baseline_keyboard_backspace_24"
app:backgroundTint="#DF4141" />
</RelativeLayout>
</FrameLayout>
</LinearLayout>
\ No newline at end of file
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
\ No newline at end of file
......@@ -11,4 +11,5 @@
<string name="description">description</string>
<string name="date">date</string>
<string name="chosendate">chosenDate</string>
<string name="dots">...</string>
</resources>
\ 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