diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index b589d56..b86273d 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
index b268ef3..505df14 100644
--- a/.idea/deploymentTargetSelector.xml
+++ b/.idea/deploymentTargetSelector.xml
@@ -4,6 +4,14 @@
+
+
+
+
+
+
+
+
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 58b0d55..efacb99 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -1,24 +1,18 @@
-<<<<<<< HEAD
-=======
->>>>>>> master
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b266113..74dd639 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,16 +1,10 @@
-<<<<<<< HEAD
-
-
-
-=======
-
+
->>>>>>> master
\ No newline at end of file
diff --git a/.idea/other.xml b/.idea/other.xml
deleted file mode 100644
index a76f118..0000000
--- a/.idea/other.xml
+++ /dev/null
@@ -1,329 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..16660f1
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..c5f3f6b
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "java.configuration.updateBuildConfiguration": "interactive"
+}
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index bf2dfb5..5e850ab 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -8,7 +8,7 @@ android {
defaultConfig {
applicationId = "com.mukudev.easy2do"
- minSdk = 24
+ minSdk = 28
targetSdk = 34
versionCode = 1
versionName = "1.0"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 2e90cb4..36d6989 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -10,10 +10,10 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/easytodologo"
android:supportsRtl="true"
- android:theme="@style/Theme.Easy2Do"
+ android:theme="@style/Base.Theme.Easy2Do"
tools:targetApi="31">
@@ -21,6 +21,7 @@
+
-
\ No newline at end of file
+
diff --git a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2DayRule.java b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2DayRule.java
index ca3c254..8b10893 100644
--- a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2DayRule.java
+++ b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2DayRule.java
@@ -1,40 +1,191 @@
+
package com.mukudev.easy2do.Fragments;
import android.os.Bundle;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.widget.Button;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Calendar;
+import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CalendarView;
import android.widget.Toast;
+import android.widget.TextView;
import com.mukudev.easy2do.R;
public class Fragment2DayRule extends Fragment {
+ private Button markDoneButton;
+ private Set markedDays;
+ private SharedPreferences sharedPreferences;
+ private CalendarView calendarView;
+ private TextView streakTextView;
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
-
View view = inflater.inflate(R.layout.fragment_2day_rule, container, false);
- // Initialize the CalendarView
- CalendarView calendarView = view.findViewById(R.id.calendarView);
+ calendarView = view.findViewById(R.id.calendarView);
+ markDoneButton = view.findViewById(R.id.markDoneButton);
+ streakTextView = view.findViewById(R.id.streakTextView);
- // Set OnDateChangeListener to capture date changes
- calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
- @Override
- public void onSelectedDayChange(CalendarView view, int year, int month, int dayOfMonth) {
+ sharedPreferences = requireContext().getSharedPreferences("HabitTracker", Context.MODE_PRIVATE);
+ markedDays = new HashSet<>(sharedPreferences.getStringSet("markedDays", new HashSet<>()));
- String selectedDate = dayOfMonth + "/" + (month + 1) + "/" + year;
+ setupCalendarView();
+ setupMarkDoneButton();
+ updateStreak();
+
+ return view;
+ }
- // Add functionality to save the mark date and it should be asserted because it cannot change after its marked
- Toast.makeText(getContext(), "Selected Date: " + selectedDate, Toast.LENGTH_SHORT).show();
+ private void setupCalendarView() {
+ Calendar today = Calendar.getInstance();
+ calendarView.setMaxDate(today.getTimeInMillis());
+ calendarView.setOnDateChangeListener((view, year, month, dayOfMonth) -> {
+ Calendar selectedDate = Calendar.getInstance();
+ selectedDate.set(year, month, dayOfMonth);
+ Calendar currentDate = Calendar.getInstance();
+
+ if (selectedDate.before(currentDate)) {
+ showPastDatePopup();
+ } else if (selectedDate.after(currentDate)) {
+ Toast.makeText(getContext(), "You cannot select future dates", Toast.LENGTH_SHORT).show();
+ } else {
+ updateMarkDoneButtonState(selectedDate);
+ if (!isCurrentDateMarked()) {
+ showMarkAsDoneConfirmation();
+ } else {
+ Toast.makeText(getContext(), "This day is already marked as done!", Toast.LENGTH_SHORT).show();
+ }
}
});
- return view;
+ calendarView.setDate(today.getTimeInMillis(), false, true);
+ highlightDates();
+ }
+
+ private void setupMarkDoneButton() {
+ markDoneButton.setOnClickListener(v -> showMarkAsDoneConfirmation());
+ updateMarkDoneButtonState(Calendar.getInstance());
+ }
+
+ private void showPastDatePopup() {
+ new AlertDialog.Builder(requireContext())
+ .setTitle("Past Date")
+ .setMessage("You cannot select previous dates.")
+ .setPositiveButton("OK", null)
+ .show();
+ }
+
+ private void showMarkAsDoneConfirmation() {
+ new AlertDialog.Builder(requireContext())
+ .setTitle("Mark as Done")
+ .setMessage("Are you sure you want to mark this day as done? This action cannot be undone.")
+ .setPositiveButton("Yes", (dialog, which) -> markTodayAsDone())
+ .setNegativeButton("No", null)
+ .show();
+ }
+
+ private void markTodayAsDone() {
+ Calendar calendar = Calendar.getInstance();
+ String currentDate = formatDate(calendar);
+
+ if (!markedDays.contains(currentDate)) {
+ markedDays.add(currentDate);
+ SharedPreferences.Editor editor = sharedPreferences.edit();
+ editor.putStringSet("markedDays", markedDays);
+ editor.apply();
+
+ Toast.makeText(getContext(), "Marked as done!", Toast.LENGTH_SHORT).show();
+ }
+ updateMarkDoneButtonState(calendar);
+ updateStreak();
+ highlightDates();
+ }
+
+ private void updateMarkDoneButtonState(Calendar selectedDate) {
+ boolean isToday = isToday(selectedDate);
+ String currentDate = formatDate(selectedDate);
+ markDoneButton.setEnabled(isToday && !markedDays.contains(currentDate));
+ }
+ private String formatDate(Calendar calendar) {
+ return calendar.get(Calendar.DAY_OF_MONTH) + "/" +
+ (calendar.get(Calendar.MONTH) + 1) + "/" +
+ calendar.get(Calendar.YEAR);
}
+ private boolean isToday(Calendar date) {
+ Calendar today = Calendar.getInstance();
+ return date.get(Calendar.YEAR) == today.get(Calendar.YEAR) &&
+ date.get(Calendar.MONTH) == today.get(Calendar.MONTH) &&
+ date.get(Calendar.DAY_OF_MONTH) == today.get(Calendar.DAY_OF_MONTH);
+ }
+
+ private boolean isCurrentDateMarked() {
+ Calendar calendar = Calendar.getInstance();
+ String currentDate = formatDate(calendar);
+ return markedDays.contains(currentDate);
+ }
+
+ private void updateStreak() {
+ int streak = calculateStreak();
+ streakTextView.setText("Current Streak: " + streak + " days");
+ }
+
+ private int calculateStreak() {
+ Calendar today = Calendar.getInstance();
+ int streak = 0;
+
+ while (markedDays.contains(formatDate(today))) {
+ streak++;
+ today.add(Calendar.DAY_OF_MONTH, -1);
+ }
+
+ return streak;
+ }
+
+ private View getDayViewByDate(long dateInMillis) {
+ // Implement the logic to get the day view by date
+ // This is a placeholder implementation and may need to be adjusted based on your CalendarView implementation
+ return calendarView.findViewWithTag(dateInMillis);
+ }
+
+ private void highlightDates() {
+ for (String date : markedDays) {
+ // Logic to highlight the marked dates
+ String[] parts = date.split("/");
+ int day = Integer.parseInt(parts[0]);
+ int month = Integer.parseInt(parts[1]) - 1; // Calendar months are 0-based
+ int year = Integer.parseInt(parts[2]);
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.set(year, month, day);
+
+ long dateInMillis = calendar.getTimeInMillis();
+ calendarView.setDate(dateInMillis, false, true);
+
+ // Assuming you have a method to get the day view by date
+ View dayView = getDayViewByDate(dateInMillis);
+ if (dayView != null) {
+ dayView.setBackgroundResource(R.drawable.dark_red_circle);
+ }
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ setupCalendarView();
+ updateMarkDoneButtonState(Calendar.getInstance());
+ updateStreak();
+ }
}
diff --git a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2MinTaskRule.java b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2MinTaskRule.java
index 8ee7752..6d9dc3a 100644
--- a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2MinTaskRule.java
+++ b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2MinTaskRule.java
@@ -5,6 +5,7 @@
import androidx.fragment.app.Fragment;
import android.os.CountDownTimer;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -16,6 +17,9 @@
public class Fragment2MinTaskRule extends Fragment {
private TextView timerTextView;
private Button startTimerButton;
+
+ //boolean to check if button is clicked
+ private boolean isClicked = false;
private CountDownTimer countDownTimer;
@Override
@@ -27,20 +31,60 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
startTimerButton.setOnClickListener(new View.OnClickListener() {
@Override
+ //animation for button click
public void onClick(View v) {
- startTimer();
+ startTimerButton.setScaleX(0.9f);
+ startTimerButton.setScaleY(0.9f);
+
+ // Restore the button size after a short delay
+ startTimerButton.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ startTimerButton.setScaleX(1f);
+ startTimerButton.setScaleY(1f);
+ }
+ }, 100);//animation for button click
+ //check if the button is clicked and then only call startTimer
+ if(!isClicked) startPreparationTimer();
}
});
return view;
}
+
+ private void startPreparationTimer() {
+ //on start set to true to avoid flickering of timer when button is clicked while it is running
+ isClicked = true;
+ // Set text to inform the user to get ready
+ timerTextView.setText("Get ready in 5 seconds...");
+ timerTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 24);
+
+ isClicked = true; // Mark that the button has been clicked
+
+ // Create a CountDownTimer for 5 seconds (5000 milliseconds)
+ new CountDownTimer(5000, 1000) {
+ @Override
+ public void onTick(long millisUntilFinished) {
+ // Update the text to show the remaining time
+ int secondsRemaining = (int) (millisUntilFinished / 1000);
+ timerTextView.setText("Get ready in " + secondsRemaining + " seconds...");
+ }
+
+ @Override
+ public void onFinish() {
+ // After preparation time, start the main task timer
+ startTimer();
+ }
+ }.start();
+ }
private void startTimer() {
// Reset the timer text to 2 minutes
timerTextView.setText("02:00");
+ timerTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP,64);
// Create a CountDownTimer for 2 minutes (120000 milliseconds)
- countDownTimer = new CountDownTimer(10000, 1000) {
+ countDownTimer = new CountDownTimer(120000, 1000) {
@Override
public void onTick(long millisUntilFinished) {
// Update the timer text every second
@@ -53,8 +97,11 @@ public void onTick(long millisUntilFinished) {
public void onFinish() {
// Timer finished, play sound
timerTextView.setText("Time's up!");
+ timerTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP,24);
playSound();
startTimerButton.setText("Restart!");
+ //on finish set to false so that the timer can start again on clicking button
+ isClicked = false;
}
}.start();
}
diff --git a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2PriorityTaskRule.java b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2PriorityTaskRule.java
index 04c3558..37b4c59 100644
--- a/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2PriorityTaskRule.java
+++ b/app/src/main/java/com/mukudev/easy2do/Fragments/Fragment2PriorityTaskRule.java
@@ -1,6 +1,17 @@
package com.mukudev.easy2do.Fragments;
import android.os.Bundle;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.app.AlertDialog;
+import android.widget.Toast;
+import java.util.Calendar;
+import java.util.Random;
+import android.widget.CheckBox;
+import android.widget.EditText;
+import android.widget.TextView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -8,13 +19,159 @@
import androidx.fragment.app.Fragment;
import com.mukudev.easy2do.R;
+import com.google.android.material.card.MaterialCardView;
public class Fragment2PriorityTaskRule extends Fragment {
+ // List of motivational quotes
+ private static final String[] quotes = {
+ "Great job on completing your first task!",
+ "Keep up the great work!",
+ "You're doing amazing!",
+ "You're making excellent progress!",
+ "Well done on prioritizing your tasks!"
+ };
+
+ // Function to get a random quote
+ private String getRandomQuote() {
+ int index = new Random().nextInt(quotes.length);
+ return quotes[index];
+ }
+
+ private void handleTaskCompletion(CheckBox checkbox, EditText input, String taskKey, String message, SharedPreferences.Editor editor, View cardView) {
+ new AlertDialog.Builder(getContext())
+ .setTitle("Confirm Task Completion")
+ .setMessage("Are you sure you want to mark this task as completed? This action cannot be undone.")
+ .setPositiveButton(android.R.string.yes, (dialog, which) -> {
+ input.setEnabled(false);
+ checkbox.setEnabled(false);
+ editor.putBoolean(taskKey, true);
+ editor.apply();
+ Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
+ cardView.setBackgroundColor(getResources().getColor(android.R.color.holo_green_light));
+
+ boolean bothTasksCompleted = getActivity().getSharedPreferences("PriorityTasks", Context.MODE_PRIVATE)
+ .getBoolean("task1_completed", false) && getActivity().getSharedPreferences("PriorityTasks", Context.MODE_PRIVATE)
+ .getBoolean("task2_completed", false);
+
+ TextView motivationalMessage = getView().findViewById(R.id.motivational_message);
+ if (bothTasksCompleted) {
+ motivationalMessage.setText("Awesome! You've completed both tasks!");
+ } else if (getRandomQuote().equals("Fantastic effort!")) {
+ String quote = getRandomQuote();
+ while (quote.equals("Fantastic effort!")) {
+ quote = getRandomQuote();
+ }
+ motivationalMessage.setText(quote);
+ } else {
+ motivationalMessage.setText(getRandomQuote());
+ }
+ motivationalMessage.setVisibility(View.VISIBLE);
+ })
+ .setNegativeButton(android.R.string.no, (dialog, which) -> {
+ checkbox.setChecked(false);
+ })
+ .setIcon(android.R.drawable.ic_dialog_alert)
+ .show();
+ }
+
+
+
+
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- return inflater.inflate(R.layout.fragment_2priority_task_rule, container, false);
- }
+ View view = inflater.inflate(R.layout.fragment_2priority_task_rule, container, false);
+
+ EditText task1Input = view.findViewById(R.id.task1_input);
+ CheckBox task1Checkbox = view.findViewById(R.id.task1_checkbox);
+ EditText task2Input = view.findViewById(R.id.task2_input);
+ CheckBox task2Checkbox = view.findViewById(R.id.task2_checkbox);
+ TextView motivationalMessage = view.findViewById(R.id.motivational_message);
+ View task1Card = view.findViewById(R.id.task1_card);
+ View task2Card = view.findViewById(R.id.task2_card);
+
+ SharedPreferences sharedPreferences = getActivity().getSharedPreferences("PriorityTasks", Context.MODE_PRIVATE);
+ SharedPreferences.Editor editor = sharedPreferences.edit();
+
+ Calendar now = Calendar.getInstance();
+ long currentTime = now.getTimeInMillis();
+ long lastResetTime = sharedPreferences.getLong("last_reset_time", 0);
+ boolean shouldReset = currentTime - lastResetTime > 24 * 60 * 60 * 1000; // 24 hours in milliseconds
+
+ boolean task1Completed = sharedPreferences.getBoolean("task1_completed", false);
+ boolean task2Completed = sharedPreferences.getBoolean("task2_completed", false);
+
+ if (shouldReset) {
+ // It's a new day, perform reset
+ editor.clear();
+ editor.putLong("last_reset_time", currentTime);
+ editor.apply();
+
+ task1Input.setText("");
+ task2Input.setText("");
+ task1Checkbox.setChecked(false);
+ task2Checkbox.setChecked(false);
+ task1Input.setEnabled(true);
+ task2Input.setEnabled(true);
+ task1Checkbox.setEnabled(true);
+ task2Checkbox.setEnabled(true); // Enable both checkboxes
+ motivationalMessage.setVisibility(View.GONE);
+ task1Completed = false;
+ task2Completed = false;
+ } else {
+ // Restore saved state
+ task1Input.setText(sharedPreferences.getString("task1", ""));
+ task2Input.setText(sharedPreferences.getString("task2", ""));
+ task1Checkbox.setChecked(task1Completed);
+ task2Checkbox.setChecked(task2Completed);
+ task1Input.setEnabled(!task1Completed);
+ task2Input.setEnabled(!task2Completed);
+ task1Checkbox.setEnabled(!task1Completed);
+ task2Checkbox.setEnabled(!task2Completed);
+ }
+
+ task1Input.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {}
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ editor.putString("task1", s.toString());
+ editor.apply();
+ }
+ });
+
+ task2Input.addTextChangedListener(new TextWatcher() {
+ @Override
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
+
+ @Override
+ public void onTextChanged(CharSequence s, int start, int before, int count) {}
+
+ @Override
+ public void afterTextChanged(Editable s) {
+ editor.putString("task2", s.toString());
+ editor.apply();
+ }
+ });
+
+ task1Checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ if (isChecked) {
+ handleTaskCompletion(task1Checkbox, task1Input, "task1_completed", "Task 1 completed!", editor, task1Card);
+ }
+ });
+
+ task2Checkbox.setOnCheckedChangeListener((buttonView, isChecked) -> {
+ if (isChecked) {
+ handleTaskCompletion(task2Checkbox, task2Input, "task2_completed", "Task 2 completed!", editor, task2Card);
+ }
+ });
+
+ return view;
+ }
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/mukudev/easy2do/MainActivity.java b/app/src/main/java/com/mukudev/easy2do/MainActivity.java
index 9191529..b49f288 100644
--- a/app/src/main/java/com/mukudev/easy2do/MainActivity.java
+++ b/app/src/main/java/com/mukudev/easy2do/MainActivity.java
@@ -2,9 +2,13 @@
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentTransaction;
+
import android.os.Bundle;
+import android.view.Menu;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.mukudev.easy2do.Fragments.Fragment2DayRule;
@@ -13,43 +17,53 @@
public class MainActivity extends AppCompatActivity {
+
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation);
+ Toolbar toolbar = findViewById(R.id.toolBar);//object of ToolBar
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_container, new Fragment2DayRule())
.commit();
+ toolbar.setTitle("Building Habits Can be Tough");//changing according to fragment
+
bottomNavigationView.setSelectedItemId(R.id.nav_2day_rule);
}
// Set the BottomNavigationView listener
- bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
+ bottomNavigationView.setOnItemSelectedListener(new BottomNavigationView.OnItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull android.view.MenuItem item) {
Fragment selectedFragment = null;
if (item.getItemId() == R.id.nav_2min_task_rule) {
selectedFragment = new Fragment2MinTaskRule();
+ toolbar.setTitle("Get Things Done Faster!");//changing according to fragment
}
else if (item.getItemId() == R.id.nav_2day_rule) {
selectedFragment = new Fragment2DayRule();
+ toolbar.setTitle("Building Habits Can be Tough");//changing according to fragment
}
else{
selectedFragment = new Fragment2PriorityTaskRule();
+ toolbar.setTitle("Priority Tasks for Today");//changing according to fragment
}
// Replace the fragment
+ //added transition for fragment change
getSupportFragmentManager().beginTransaction()
+ .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.fragment_container, selectedFragment)
.commit();
@@ -57,4 +71,10 @@ else if (item.getItemId() == R.id.nav_2day_rule) {
}
});
}
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ getMenuInflater().inflate(R.menu.toolbar, menu);
+ return true;
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/mukudev/easy2do/SplashActivity.java b/app/src/main/java/com/mukudev/easy2do/SplashActivity.java
new file mode 100644
index 0000000..2afa9a9
--- /dev/null
+++ b/app/src/main/java/com/mukudev/easy2do/SplashActivity.java
@@ -0,0 +1,23 @@
+package com.mukudev.easy2do;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import androidx.appcompat.app.AppCompatActivity;
+
+public class SplashActivity extends AppCompatActivity {
+ private static final int SPLASH_SCREEN_DELAY = 2000; // 2 seconds
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_splash);
+
+ //Handler to control the time of splash screen and move to main activity
+ new Handler().postDelayed(() -> {
+ Intent intent = new Intent(SplashActivity.this, MainActivity.class);
+ startActivity(intent);
+ finish(); // Close the SplashActivity so the user can't go back to it
+ }, SPLASH_SCREEN_DELAY);
+ }
+}
diff --git a/app/src/main/res/drawable-anydpi/ic_moon.xml b/app/src/main/res/drawable-anydpi/ic_moon.xml
new file mode 100644
index 0000000..fe3ca24
--- /dev/null
+++ b/app/src/main/res/drawable-anydpi/ic_moon.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/src/main/res/drawable-anydpi/ic_sun.xml b/app/src/main/res/drawable-anydpi/ic_sun.xml
new file mode 100644
index 0000000..9d18533
--- /dev/null
+++ b/app/src/main/res/drawable-anydpi/ic_sun.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/src/main/res/drawable-hdpi/ic_moon.png b/app/src/main/res/drawable-hdpi/ic_moon.png
new file mode 100644
index 0000000..55c9fd6
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_moon.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_sun.png b/app/src/main/res/drawable-hdpi/ic_sun.png
new file mode 100644
index 0000000..ba1ce7f
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_sun.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_moon.png b/app/src/main/res/drawable-mdpi/ic_moon.png
new file mode 100644
index 0000000..7712324
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_moon.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_sun.png b/app/src/main/res/drawable-mdpi/ic_sun.png
new file mode 100644
index 0000000..0190f1c
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_sun.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_moon.png b/app/src/main/res/drawable-xhdpi/ic_moon.png
new file mode 100644
index 0000000..8fc65a5
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_moon.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_sun.png b/app/src/main/res/drawable-xhdpi/ic_sun.png
new file mode 100644
index 0000000..03dee65
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_sun.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_moon.png b/app/src/main/res/drawable-xxhdpi/ic_moon.png
new file mode 100644
index 0000000..0fecdd9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_moon.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_sun.png b/app/src/main/res/drawable-xxhdpi/ic_sun.png
new file mode 100644
index 0000000..5231832
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_sun.png differ
diff --git a/app/src/main/res/drawable/circle.xml b/app/src/main/res/drawable/circle.xml
new file mode 100644
index 0000000..f5fdc6e
--- /dev/null
+++ b/app/src/main/res/drawable/circle.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/dark_red_circle.xml b/app/src/main/res/drawable/dark_red_circle.xml
new file mode 100644
index 0000000..2fd16a2
--- /dev/null
+++ b/app/src/main/res/drawable/dark_red_circle.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/easytodologo.jpeg b/app/src/main/res/drawable/easytodologo.jpeg
new file mode 100644
index 0000000..b7285fd
Binary files /dev/null and b/app/src/main/res/drawable/easytodologo.jpeg differ
diff --git a/app/src/main/res/drawable/rectangle.xml b/app/src/main/res/drawable/rectangle.xml
new file mode 100644
index 0000000..60d1168
--- /dev/null
+++ b/app/src/main/res/drawable/rectangle.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/selector.xml b/app/src/main/res/drawable/selector.xml
index 82f6aee..397c092 100644
--- a/app/src/main/res/drawable/selector.xml
+++ b/app/src/main/res/drawable/selector.xml
@@ -1,5 +1,4 @@
-
\ No newline at end of file
diff --git a/app/src/main/res/font/font.xml b/app/src/main/res/font/font.xml
new file mode 100644
index 0000000..9d88007
--- /dev/null
+++ b/app/src/main/res/font/font.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/font/roboto_bold.ttf b/app/src/main/res/font/roboto_bold.ttf
new file mode 100644
index 0000000..e64db79
Binary files /dev/null and b/app/src/main/res/font/roboto_bold.ttf differ
diff --git a/app/src/main/res/font/roboto_regular.ttf b/app/src/main/res/font/roboto_regular.ttf
new file mode 100644
index 0000000..2d116d9
Binary files /dev/null and b/app/src/main/res/font/roboto_regular.ttf differ
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index e284c44..5cbd5f0 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,18 +1,36 @@
-
-
+ android:layout_height="match_parent"
+ android:orientation="vertical">
-
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml
new file mode 100644
index 0000000..d78da0d
--- /dev/null
+++ b/app/src/main/res/layout/activity_splash.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_2day_rule.xml b/app/src/main/res/layout/fragment_2day_rule.xml
index 48e9006..ecd9d39 100644
--- a/app/src/main/res/layout/fragment_2day_rule.xml
+++ b/app/src/main/res/layout/fragment_2day_rule.xml
@@ -1,43 +1,60 @@
+
-
-
+ android:orientation="vertical"
+ android:theme="@style/Base.Theme.Easy2Do">
+ android:textStyle="bold"
+ app:layout_constraintTop_toTopOf="parent"
+ tools:layout_editor_absoluteX="0dp" />
+
+ app:layout_constraintTop_toBottomOf="@+id/streakTextView"
+ android:background="@drawable/rectangle"/>
-
-
-
-
+ android:text="Mark as Done"
+ android:layout_marginTop="16dp"
+ app:layout_constraintTop_toBottomOf="@+id/calendarView"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"/>
diff --git a/app/src/main/res/layout/fragment_2min_task_rule.xml b/app/src/main/res/layout/fragment_2min_task_rule.xml
index 7bc38e2..32f4278 100644
--- a/app/src/main/res/layout/fragment_2min_task_rule.xml
+++ b/app/src/main/res/layout/fragment_2min_task_rule.xml
@@ -1,36 +1,57 @@
+ android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:theme="@style/Base.Theme.Easy2Do">
+
+
+ android:textSize="64sp"
+ android:textColor="?attr/colorOnPrimary"
+ android:layout_gravity="center"/>
+
+
+ android:textSize="18sp"
+ android:textStyle="bold"
+ android:textColor="?attr/colorOnPrimary"/>
-
+ android:layout_marginTop="30dp"/>
diff --git a/app/src/main/res/layout/fragment_2priority_task_rule.xml b/app/src/main/res/layout/fragment_2priority_task_rule.xml
index 35eecf7..1ce7c98 100644
--- a/app/src/main/res/layout/fragment_2priority_task_rule.xml
+++ b/app/src/main/res/layout/fragment_2priority_task_rule.xml
@@ -1,14 +1,121 @@
+
+ android:padding="16dp"
+ android:background="@android:color/white">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ android:layout_marginBottom="16dp"
+ app:cardElevation="4dp"
+ app:cardCornerRadius="8dp">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/menu/toolbar.xml b/app/src/main/res/menu/toolbar.xml
new file mode 100644
index 0000000..762cbf8
--- /dev/null
+++ b/app/src/main/res/menu/toolbar.xml
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml
index 02366cd..8c620c6 100644
--- a/app/src/main/res/values-night/themes.xml
+++ b/app/src/main/res/values-night/themes.xml
@@ -1,7 +1,11 @@
\ No newline at end of file
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 088ea20..071ca25 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,7 +1,10 @@
- #FF000000
- #FFFFFFFF
- #7D7D7D
-
-
\ No newline at end of file
+ #000000
+ #FFFFFF
+ #F0FFF0
+ #00A86B
+ #4a00e0
+ #2A2828
+ #555D50
+
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index d84683d..52779df 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -1,11 +1,43 @@
+
+
+
+
+
+
+
-
\ No newline at end of file
+
+
+
+
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index 594d212..300bf77 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,9 +1,26 @@
+
-
+
+
+
\ No newline at end of file
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 5d458ad..4ce0601 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
[versions]
-agp = "8.5.2"
+agp = "8.7.1"
junit = "4.13.2"
junitVersion = "1.2.1"
espressoCore = "3.6.1"
@@ -7,7 +7,7 @@ appcompat = "1.7.0"
material = "1.12.0"
activity = "1.9.2"
constraintlayout = "2.1.4"
-fragement= "1.5.7"
+fragment= "1.5.7"
[libraries]
junit = { group = "junit", name = "junit", version.ref = "junit" }
ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
@@ -16,7 +16,7 @@ appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "a
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
-androidx-fragment = { module = "androidx.fragment:fragment", version = "1.5.7" }
+androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "fragment" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index a9c4f59..53eb5c0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Sun Oct 06 10:55:03 IST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists