diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml
new file mode 100644
index 0000000..f256477
--- /dev/null
+++ b/.idea/deploymentTargetDropDown.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b866680..1ffe264 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
-
+
diff --git a/app/src/main/java/com/example/todoappjava/MainActivity.java b/app/src/main/java/com/example/todoappjava/MainActivity.java
index 31beabd..96aa579 100644
--- a/app/src/main/java/com/example/todoappjava/MainActivity.java
+++ b/app/src/main/java/com/example/todoappjava/MainActivity.java
@@ -9,6 +9,7 @@
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.TextView;
import android.widget.Toast;
import com.example.todoappjava.db.DatabaseHelper;
@@ -23,45 +24,55 @@ public class MainActivity extends AppCompatActivity implements TodoAdapter.OnIte
private final ArrayList todoList = new ArrayList<>();
private final TodoAdapter todoAdapter = new TodoAdapter(todoList, this);
-
private final DatabaseHelper myDB = new DatabaseHelper(this);
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
-
initViews();
rvTodos.setLayoutManager(new LinearLayoutManager(this));
rvTodos.setAdapter(todoAdapter);
loadTodos();
-
btnAddTodo.setOnClickListener(v -> addTodo());
}
private void addTodo() {
String text = etTodo.getText().toString();
- boolean isSuccess = myDB.insertData(text);
- if(isSuccess){
- Toast.makeText(this, "Todo added successfully!", Toast.LENGTH_SHORT).show();
+ if(text.isEmpty())
+ {
+ // Bug 1 fixed
+ Toast.makeText(MainActivity.this, "Empty TODO can't be saved", Toast.LENGTH_SHORT).show();
+ }
+ else{
+ boolean isSuccess = myDB.insertData(text);
+ //App Not Crashing
+ Toast.makeText(MainActivity.this, "Todo added successfully!", Toast.LENGTH_SHORT).show();
loadTodos();
- } else {
- Toast.makeText(this, "Something went wrong!", Toast.LENGTH_SHORT).show();
+ //Solved bug 2
+ etTodo.setText("");
}
}
-
+ private TextView tt;
@SuppressLint("NotifyDataSetChanged")
private void loadTodos() {
Cursor cursor = myDB.getAllData();
if(cursor!=null){
+ tt=findViewById(R.id.textView);
if (cursor.moveToFirst()) {
+ tt.setText("");
String todoText;
int todoId;
+ // bug 3 Fixed
do {
todoId = cursor.getInt(cursor.getColumnIndex(DatabaseHelper.TODO_ID));
todoText = cursor.getString(cursor.getColumnIndex(DatabaseHelper.TODO_TEXT));
- todoList.add(new TodoData(todoId, todoText));
} while (cursor.moveToNext());
+ todoList.add(new TodoData(todoId, todoText));
+ }
+ else{
+ // bug 7 fixed
+ tt.setText("TODO LIST Empty !! \n ADD A Task to see the LIST .");
}
cursor.close();
todoAdapter.notifyDataSetChanged();
@@ -73,7 +84,6 @@ private void initViews() {
etTodo = findViewById(R.id.etTodo);
btnAddTodo = findViewById(R.id.btnAddTodo);
}
-
@Override
public void onDeleteClick(int position) {
String itemIdToDelete = String.valueOf(todoList.get(position).getId());
diff --git a/app/src/main/java/com/example/todoappjava/TodoAdapter.java b/app/src/main/java/com/example/todoappjava/TodoAdapter.java
index 6605fdd..b94b114 100644
--- a/app/src/main/java/com/example/todoappjava/TodoAdapter.java
+++ b/app/src/main/java/com/example/todoappjava/TodoAdapter.java
@@ -46,6 +46,7 @@ class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
public ViewHolder(@NonNull View itemView) {
super(itemView);
+ tvTodoId=itemView.findViewById(R.id.tvTodoId);
tvTodoText = itemView.findViewById(R.id.tvTodoText);
btnDelete = itemView.findViewById(R.id.btnDelete);
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 29ce29d..8b096ac 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,6 +1,5 @@
-
+ android:hint="@string/enter_todo_text"
+ android:inputType="textCapSentences"
+ tools:ignore="TextContrastCheck" />
+ android:text="@string/add" />
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/todo_item.xml b/app/src/main/res/layout/todo_item.xml
index 1e4beb8..b81d77f 100644
--- a/app/src/main/res/layout/todo_item.xml
+++ b/app/src/main/res/layout/todo_item.xml
@@ -13,7 +13,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:paddingHorizontal="14dp"
- android:text="1"
+ android:text="@string/_1"
android:textSize="20sp" />
@@ -43,6 +43,7 @@
android:layout_marginBottom="0dp"
android:background="?android:selectableItemBackground"
android:foregroundGravity="right"
- android:src="@drawable/ic_delete" />
+ android:src="@drawable/ic_delete"
+ tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
deleted file mode 100644
index eca70cf..0000000
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
deleted file mode 100644
index eca70cf..0000000
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a30c045
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/app/src/main/res/mipmap-hdpi/ic_launcher.webp
deleted file mode 100644
index c209e78..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..dec08fd
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..d77224f
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000..a30c045
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
deleted file mode 100644
index b2dfe3d..0000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_back.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_back.png
new file mode 100644
index 0000000..dec08fd
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_fore.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_fore.png
new file mode 100644
index 0000000..d77224f
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..5b03e37
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/app/src/main/res/mipmap-mdpi/ic_launcher.webp
deleted file mode 100644
index 4f0f1d6..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..a7f91f5
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..ecc98cf
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000..5b03e37
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
deleted file mode 100644
index 62b611d..0000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_back.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_back.png
new file mode 100644
index 0000000..a7f91f5
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_fore.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_fore.png
new file mode 100644
index 0000000..ecc98cf
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..368b207
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
deleted file mode 100644
index 948a307..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..fdedb28
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..e95c498
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..368b207
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
deleted file mode 100644
index 1b9a695..0000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_back.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_back.png
new file mode 100644
index 0000000..fdedb28
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_fore.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_fore.png
new file mode 100644
index 0000000..e95c498
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..e56d7a3
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
deleted file mode 100644
index 28d4b77..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..f9ed59a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..9bfb2cb
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..e56d7a3
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9287f50..0000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_back.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_back.png
new file mode 100644
index 0000000..f9ed59a
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_fore.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_fore.png
new file mode 100644
index 0000000..9bfb2cb
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..f3349cc
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
deleted file mode 100644
index aa7d642..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png
new file mode 100644
index 0000000..5fe8102
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png
new file mode 100644
index 0000000..8552f3c
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_adaptive_fore.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000..f3349cc
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
deleted file mode 100644
index 9126ae3..0000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_back.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_back.png
new file mode 100644
index 0000000..5fe8102
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_back.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_fore.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_fore.png
new file mode 100644
index 0000000..8552f3c
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round_adaptive_fore.png differ
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e4795f7..0f71341 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,7 @@
Todo App Java
+ 1
+ Some Todo Text
+ Add
+ Enter Todo Text
\ No newline at end of file