Commit ee81816f authored by 9731301's avatar 9731301

add calender ui and library

parent c29249ac
......@@ -32,6 +32,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
compile 'com.alirezaafkar:sundatepicker:2.0.4'
def room_version = "2.2.5"
......
......@@ -9,7 +9,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MenuFeatures.Calender.Calender"></activity>
<activity android:name=".MenuFeatures.Calender.MyCalenderActivity"></activity>
<activity android:name=".MenuFeatures.VoiceMassages.VoiceMassages" />
<activity android:name=".MenuFeatures.AllNotes.AllNotesActivity" />
<activity android:name=".MenuFeatures.AllAchievedNotes.AchivedNotesActivity" />
......
......@@ -51,7 +51,6 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
customMenu.setInfoClickListener(new InfoClickListener() {
@Override
public void onInfoTvClicked(TextView infoTv) {
System.out.println("hiiiiiiiiii");
informationView.setVisibility(View.VISIBLE);
}
});
......
......@@ -10,14 +10,13 @@ import android.widget.TextView;
import com.example.mynotepad.MenuFeatures.AllAchievedNotes.AchivedNotesActivity;
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.R;
import com.google.android.material.snackbar.Snackbar;
import java.util.Calendar;
public class CustomMenu extends LinearLayout implements View.OnClickListener {
private View rootView;
private TextView settingTv, allNotesTv, achievedTv, calenderTv, informationTv, voiceMassagesTv;
......@@ -79,7 +78,7 @@ public class CustomMenu extends LinearLayout implements View.OnClickListener {
}
private void showCalender() {
Intent intent = new Intent(getContext(), Calendar.class);
Intent intent = new Intent(getContext(), MyCalenderActivity.class);
getContext().startActivity(intent);
}
......
......@@ -14,7 +14,6 @@ import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyAdaptor;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote;
......@@ -22,9 +21,9 @@ import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.OnItemClic
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.CustomToolbarOption;
import com.example.mynotepad.R;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.List;
......@@ -36,7 +35,7 @@ public class AllNotesActivity extends AppCompatActivity {
private FloatingActionButton addNoteButton;
private FragmentTransaction fragmentTransaction;
private CustomToolbarOption customToolbarOption;
private TextView allNoteToolBar;
private FrameLayout allNoteToolBar;
private RecyclerView recyclerView;
private MyAdaptor myAdaptor;
private List<Note> notes;
......@@ -116,7 +115,7 @@ public class AllNotesActivity extends AppCompatActivity {
});
//add listener to custom toolbar option and set being achieved or not to be saved in database
customToolbarOption.setCustomToolbarOptionListener(new CustomToolbarOptionListener() {
customToolbarOption.setCustomToolbarOptionListener(new CustomAllNotesToolbarOptionListener() {
@Override
public void onStarClicked(ImageView yellowS, ImageView blackS) {
if (yellowS.getVisibility() == View.VISIBLE){
......
......@@ -2,9 +2,8 @@ package com.example.mynotepad.MenuFeatures.AllNotes;
import android.widget.ImageView;
import com.example.mynotepad.MenuFeatures.AllNotes.MyNoteRecyclerView.MyNote;
public interface CustomToolbarOptionListener {
public interface CustomAllNotesToolbarOptionListener {
void onStarClicked(ImageView yellowS , ImageView blackS);
void onDeleteClicked(ImageView imageView);
void onCloseClicked(ImageView imageView);
......
......@@ -26,7 +26,7 @@ public class MyAdaptor extends RecyclerView.Adapter<MyAdaptor.ViewHolder> {
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_item_row, parent, false);
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.custom_allnotes_item, parent, false);
return new ViewHolder(view);
}
......
package com.example.mynotepad.MenuFeatures.Calender;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.example.mynotepad.R;
public class Calender extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_calender);
}
}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.Calender;
public interface CustomCalenderToolbarOptionListener {
}
package com.example.mynotepad.MenuFeatures.Calender;
import com.alirezaafkar.sundatepicker.components.DateItem;
import java.util.Calendar;
import java.util.Locale;
public class Date extends DateItem {
String getDate() {
Calendar calendar = getCalendar();
return String.format(Locale.US,
"%d/%d/%d",
getYear(), getMonth(), getDay(),
calendar.get(Calendar.YEAR),
+calendar.get(Calendar.MONTH) + 1,
+calendar.get(Calendar.DAY_OF_MONTH));
}}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.Calender;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import com.alirezaafkar.sundatepicker.DatePicker;
import com.alirezaafkar.sundatepicker.interfaces.DateSetListener;
import com.example.mynotepad.R;
import java.util.Calendar;
public class MyCalenderActivity extends AppCompatActivity {
Date mDate;
TextView tvDatePersion;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_calender);
init();
}
private void init() {
tvDatePersion = findViewById(R.id.dateTv);
DatePicker.Builder builder = new DatePicker
.Builder()
.theme(R.style.DialogTheme)
.future(true);
mDate = new Date();
builder.date(mDate.getDay(), mDate.getMonth(), mDate.getYear());
builder.build(new DateSetListener() {
@Override
public void onDateSet(int id, @Nullable Calendar calendar, int day, int month, int year) {
mDate.setDate(day, month, year);
//textView
tvDatePersion.setText(mDate.getDate());
}
}).show(getSupportFragmentManager(), "");
}
}
\ No newline at end of file
package com.example.mynotepad.MenuFeatures.AllNotes;
package com.example.mynotepad.MenuFeatures;
import android.content.Context;
import android.util.AttributeSet;
......@@ -7,12 +7,13 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import com.example.mynotepad.MenuFeatures.AllNotes.CustomAllNotesToolbarOptionListener;
import com.example.mynotepad.R;
public class CustomToolbarOption extends LinearLayout implements View.OnClickListener {
private View rootView;
private ImageView blackStarImg , yellowStarImg , deleteImg , closeImg;
private CustomToolbarOptionListener customToolbarOptionListener;
private CustomAllNotesToolbarOptionListener customToolbarOptionListener;
public CustomToolbarOption(Context context) {
super(context);
......@@ -62,7 +63,7 @@ public class CustomToolbarOption extends LinearLayout implements View.OnClickLis
}
}
public void setCustomToolbarOptionListener(CustomToolbarOptionListener customToolbarOptionListener) {
public void setCustomToolbarOptionListener(CustomAllNotesToolbarOptionListener customToolbarOptionListener) {
this.customToolbarOptionListener = customToolbarOptionListener;
}
}
......@@ -21,20 +21,32 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
<FrameLayout
android:id="@+id/allNotesToolbar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/all_notes_bg"
android:gravity="center"
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="#020930"
android:textSize="20dp" />
android:textColor="#02091E"
android:textSize="30dp" />
</FrameLayout>
<com.example.mynotepad.MenuFeatures.AllNotes.CustomToolbarOption
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id="@+id/customToolbarOption"
android:layout_width="match_parent"
android:layout_height="40dp" />
android:layout_height="50dp" />
</FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MenuFeatures.Calender.Calender">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -13,7 +13,7 @@
<Toolbar
android:id="@+id/toolBarId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="50dp"
android:background="#457FAE"
tools:targetApi="lollipop">
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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.Calender.MyCalenderActivity">
<FrameLayout
android:id="@+id/fragmentPlace"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/allNoteListAndTitle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
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_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:enabled="false"
android:text="@string/calender"
android:textColor="#02091E"
android:textSize="30dp" />
</FrameLayout>
<com.example.mynotepad.MenuFeatures.CustomToolbarOption
android:id="@+id/customToolbarOption"
android:layout_width="match_parent"
android:layout_height="50dp" />
</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/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" />
</FrameLayout>
<TextView
android:id="@+id/dateTv"
android:layout_width="153dp"
android:layout_height="40dp"
tools:layout_editor_absoluteX="132dp"
tools:layout_editor_absoluteY="466dp" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_height="100dp"
android:orientation="vertical"
android:background="@drawable/row_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/titleTv"
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_marginLeft="10dp"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginLeft="15dp"
android:layout_marginTop="5dp"
android:text="title"
android:textColor="#000A43"
......@@ -22,11 +19,11 @@
<TextView
android:id="@+id/descriptionTv"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_marginLeft="12dp"
android:lines="1"
android:layout_height="0dp"
android:layout_weight="3"
android:layout_marginLeft="15dp"
android:lines="3"
android:text="body text"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:background="@drawable/row_bg">
<TextView
android:id="@+id/dateTextView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="@string/date"
android:textSize="28dp"
android:gravity="center"/>
<TextView
android:id="@+id/descriptionTextView"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="6"
android:text="@string/description"
android:textSize="25dp"
android:gravity="center_vertical"/>
</LinearLayout>
\ No newline at end of file
......@@ -10,7 +10,7 @@
<ImageView
android:id="@+id/imageView5"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="51dp"
android:scaleType="fitXY"
app:srcCompat="@drawable/index" />
......
<?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="40dp"
android:layout_height="50dp"
android:background="@drawable/all_notes_bg"
android:orientation="horizontal">
......@@ -31,7 +31,7 @@
<ImageView
android:id="@+id/yellow_star"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_height="match_parent"
android:src="@drawable/yellow_star" />
</FrameLayout>
......
......@@ -5,7 +5,9 @@
<string name="all_notes">all notes</string>
<string name="hello_blank_fragment">Hello blank fragment</string>
<string name="title">title</string>
<string name="calender">calender</string>
<string name="information">information</string>
<string name="voice_massages">voice massages</string>
<string name="calender">calender</string>
<string name="description">description</string>
<string name="date">date</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