Commit ffa0cd7d authored by 9731301's avatar 9731301

add ui for voiceMassages

parent c59240c2
......@@ -9,7 +9,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity"></activity>
<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.AllNotes.AllNotesActivity" />
......
......@@ -28,6 +28,7 @@ import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static com.example.mynotepad.MainActivity.noteDataBase;
......@@ -45,6 +46,8 @@ public class AllNotesActivity extends AppCompatActivity {
private List<Note> entityNotes;
private List<MyNote> myNotes;
public static MyNote myChosenNote;
public static HashMap<MyNote , Note> myNoteNoteHashMap;
@Override
......@@ -97,7 +100,7 @@ public class AllNotesActivity extends AppCompatActivity {
final Bundle bundle = new Bundle();
bundle.putString("title", myNote.getTitle());
bundle.putString("bodyTxt", myNote.getDescription());
final NoteFragment newNoteFrag = new NoteFragment();
final NoteFragment newNoteFrag = new NoteFragment(false );
newNoteFrag.setArguments(bundle);
//change the fragment
......@@ -198,7 +201,7 @@ public class AllNotesActivity extends AppCompatActivity {
allNoteListAndTitle.setVisibility(View.GONE);
addNoteButton.hide();
NoteFragment newNoteFrag = new NoteFragment();
NoteFragment newNoteFrag = new NoteFragment(true);
replaceFragment(newNoteFrag);
}
......@@ -210,15 +213,14 @@ 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);
}
}
public MyNote getMyChosenNote() {
return myChosenNote;
}
}
\ No newline at end of file
......@@ -29,6 +29,11 @@ public class NoteFragment extends Fragment {
private Note note;
private EditText titleTxt, bodyTxt;
private FloatingActionButton back;
private boolean isAnewNote;
public NoteFragment(boolean isAnewNote){
this.isAnewNote = isAnewNote;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
......@@ -67,7 +72,6 @@ public class NoteFragment extends Fragment {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
saveNote();
Toast.makeText(getActivity(), "saved", Toast.LENGTH_SHORT).show();
getActivity().finish();
}
});
......@@ -86,8 +90,15 @@ public class NoteFragment extends Fragment {
private void saveNote() {
if (isAnewNote) {
note = new Note(titleTxt.getText().toString(), bodyTxt.getText().toString(), false);
noteDataBase.noteDao().insertNote(note);
Toast.makeText(getActivity(), "saved", Toast.LENGTH_SHORT).show();
}else {
note = AllNotesActivity.myNoteNoteHashMap.get(AllNotesActivity.myChosenNote);
noteDataBase.noteDao().updateNote(note);
Toast.makeText(getActivity(), "updated", Toast.LENGTH_SHORT).show();
}
}
......
......@@ -98,7 +98,7 @@ public class MyCalenderActivity extends AppCompatActivity {
final Bundle bundle = new Bundle();
bundle.putString("title", myChosenDateNote.getDate());
bundle.putString("bodyTxt", myChosenDateNote.getDescription());
final NoteFragment newNoteFrag = new NoteFragment();
final NoteFragment newNoteFrag = new NoteFragment(false);
newNoteFrag.setArguments(bundle);
//change the fragment
......
package com.example.mynotepad.MenuFeatures.VoiceMassages;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.mynotepad.R;
public class RecorderActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recorder);
}
}
\ No newline at end of file
......@@ -2,15 +2,36 @@ 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
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,19h4L10,5L6,5v14zM14,5v14h4L18,5h-4z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,5v14l11,-7z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="ring">
<solid android:color="#74385E80"/>
<stroke
android:width="10dp"
android:color="#F04F7EA8"/>
<corners android:radius="0dp"/>
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M18,4L6,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,6c0,-1.1 -0.9,-2 -2,-2zM18,18L6,18L6,6h12v12z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#74385E80"/>
<stroke
android:width="10dp"
android:color="#F04F7EA8"/>
<corners android:radius="0dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MenuFeatures.VoiceMassages.RecorderActivity">
<ImageView
android:id="@+id/imageView8"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="0dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/index" />
<Button
android:id="@+id/start_stopBtn"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="50dp"
android:background="@drawable/start_stop_bg" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/start_stopBtn"
android:layout_marginRight="30dp"
android:layout_toLeftOf="@id/start_stopBtn">
<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
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/start_stopBtn"
android:layout_marginLeft="30dp"
android:layout_toRightOf="@id/start_stopBtn">
<ImageView
android:id="@+id/saveVoice"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/square"
/>
</FrameLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MenuFeatures.VoiceMassages.VoiceMassages">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/voiceToolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView7"
android:layout_width="match_parent"
android:layout_height="50dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/index" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:enabled="false"
android:text="@string/all_notes"
android:textColor="#02091E"
android:textSize="26dp" />
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id="@+id/customToolbarOption"
android:layout_width="match_parent"
android:layout_height="50dp" />
</FrameLayout>
</FrameLayout>
<FrameLayout
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" />
<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" />
</FrameLayout>
</LinearLayout>
<?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">
<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_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/start_stop_bg" />
<ImageView
android:id="@+id/playImg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/play"/>
<ImageView
android:id="@+id/pauseImg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/pause"/>
</FrameLayout>
<TextView
android:id="@+id/voiceName"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="@id/start_stopBtn"
android:layout_marginRight="10dp"
android:textSize="20dp"
android:gravity="center_vertical"
android:layout_marginLeft="10dp" />
</RelativeLayout>
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