Commit 00410a7c authored by 9731301's avatar 9731301

add some changes

parent c7d4b10e
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme"> android:theme="@style/AppTheme">
<activity android:name=".MenuFeatures.VoiceMassages.RecorderActivity"></activity>
<activity android:name=".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity" /> <activity android:name=".MenuFeatures.Calender.MyCalenderRecyclerView.TimePicker.DatePickerActivity" />
<activity android:name=".MenuFeatures.Calender.MyCalenderActivity" /> <activity android:name=".MenuFeatures.Calender.MyCalenderActivity" />
<activity android:name=".MenuFeatures.VoiceMassages.VoiceMassagesActivity" /> <activity android:name=".MenuFeatures.VoiceMassages.VoiceMassagesActivity" />
......
...@@ -42,7 +42,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe ...@@ -42,7 +42,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
} }
private void init() { private void init() {
noteDataBase = Room.databaseBuilder(this, NoteDataBase.class, "RoomDb").allowMainThreadQueries().build(); noteDataBase = Room.databaseBuilder(this, NoteDataBase.class, "RoomDb").fallbackToDestructiveMigration().allowMainThreadQueries().build();
customMenu = findViewById(R.id.mainListItem); customMenu = findViewById(R.id.mainListItem);
customMenu.setVisibility(customMenu.GONE); customMenu.setVisibility(customMenu.GONE);
wlcTxt = findViewById(R.id.wlcTxt); wlcTxt = findViewById(R.id.wlcTxt);
......
...@@ -206,7 +206,14 @@ public class AllNotesListFragment extends Fragment { ...@@ -206,7 +206,14 @@ public class AllNotesListFragment extends Fragment {
} }
private void showABlankNote() { private void showABlankNote() {
navController.navigate(R.id.action_allNotesListFragment_to_noteFragment); //set noteFragment data
final Bundle bundle = new Bundle();
bundle.putString("title", "");
bundle.putString("bodyTxt","");
bundle.putString("type" , "note");
//change the fragment
navController.navigate(R.id.action_allNotesListFragment_to_noteFragment ,bundle);
} }
......
...@@ -59,14 +59,13 @@ public class NoteFragment extends Fragment { ...@@ -59,14 +59,13 @@ public class NoteFragment extends Fragment {
back = view.findViewById(R.id.backBtn); back = view.findViewById(R.id.backBtn);
titleTxt = view.findViewById(R.id.myTitle); titleTxt = view.findViewById(R.id.myTitle);
bodyTxt = view.findViewById(R.id.textBody); bodyTxt = view.findViewById(R.id.textBody);
back.setOnClickListener(new View.OnClickListener() { back.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (titleTxt.getText().length()!=0&&bodyTxt.getText().length()!=0)
showAlert(); showAlert();
} }
}); });
} }
...@@ -132,8 +131,14 @@ public class NoteFragment extends Fragment { ...@@ -132,8 +131,14 @@ public class NoteFragment extends Fragment {
private void setTitleAndBodyTxt() { private void setTitleAndBodyTxt() {
Bundle bundle = getArguments(); Bundle bundle = getArguments();
isAnewNote = false;
if (bundle != null) { if (bundle != null)
if (bundle.getString("title").equals("") && bundle.getString("bodyTxt").equals("")){
isAnewNote = true;
type = bundle.getString("type");
}
else {
isAnewNote = false;
titleTxt.setText(bundle.getString("title")); titleTxt.setText(bundle.getString("title"));
bodyTxt.setText(bundle.getString("bodyTxt")); bodyTxt.setText(bundle.getString("bodyTxt"));
type = bundle.getString("type"); type = bundle.getString("type");
......
...@@ -129,7 +129,7 @@ public class RecordFragment extends Fragment implements View.OnClickListener { ...@@ -129,7 +129,7 @@ public class RecordFragment extends Fragment implements View.OnClickListener {
file.mkdirs();//create a the folders if it does not exists file.mkdirs();//create a the folders if it does not exists
} }
fileName = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss" , Locale.CANADA).format(new Date()) + ".mp3"; fileName = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss" , Locale.CANADA).format(new Date()) + ".mp3";
Log.d("filename", root.getAbsolutePath() + "/NotepadVoiceRecorder/Audios/" + fileName); Log.e("filename", root.getAbsolutePath() + "/NotepadVoiceRecorder/Audios/" + fileName);
mRecorder = new MediaRecorder(); mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
...@@ -139,18 +139,22 @@ public class RecordFragment extends Fragment implements View.OnClickListener { ...@@ -139,18 +139,22 @@ public class RecordFragment extends Fragment implements View.OnClickListener {
try { try {
mRecorder.prepare(); mRecorder.prepare();
if (mRecorder!=null)
mRecorder.start();
chronometer.setBase(SystemClock.elapsedRealtime());// to start from 00:00
chronometer.start();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.e("IOException",e.getMessage()+"");
} }
mRecorder.start();
chronometer.setBase(SystemClock.elapsedRealtime());// to start from 00:00
chronometer.start();
} }
private void stopRecording() { private void stopRecording() {
mRecorder.stop(); if (mRecorder!=null)
mRecorder.release(); { mRecorder.stop();
mRecorder.release();}
mRecorder = null; mRecorder = null;
chronometer.stop(); chronometer.stop();
chronometer.setBase(SystemClock.elapsedRealtime()); chronometer.setBase(SystemClock.elapsedRealtime());
......
...@@ -46,12 +46,11 @@ ...@@ -46,12 +46,11 @@
<TextView <TextView
android:id="@+id/wlcTxt" android:id="@+id/wlcTxt"
android:layout_width="211dp" android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="73dp" android:layout_height="73dp"
android:layout_above="@+id/imageView" android:layout_above="@+id/imageView"
android:layout_centerHorizontal="true" android:layout_marginBottom="30dp"/>
android:layout_marginTop="173dp"
android:layout_marginBottom="37dp" />
</RelativeLayout> </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