diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index e3792160..6be7f747 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -65,13 +65,13 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/ccextractor/taskwarrior/MainActivity.kt b/android/app/src/main/kotlin/com/ccextractor/taskwarrior/MainActivity.kt
deleted file mode 100644
index d2e8d9ba..00000000
--- a/android/app/src/main/kotlin/com/ccextractor/taskwarrior/MainActivity.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package com.ccextractor.taskwarrior
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity()
diff --git a/android/app/src/main/kotlin/com/example/taskwarrior/MainActivity.kt b/android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/MainActivity.kt
similarity index 69%
rename from android/app/src/main/kotlin/com/example/taskwarrior/MainActivity.kt
rename to android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/MainActivity.kt
index a72bf0d6..0316675c 100644
--- a/android/app/src/main/kotlin/com/example/taskwarrior/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/MainActivity.kt
@@ -2,5 +2,4 @@ package com.ccextractor.taskwarriorflutter
import io.flutter.embedding.android.FlutterActivity
-class MainActivity: FlutterActivity() {
-}
+class MainActivity: FlutterActivity()
diff --git a/android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/TaskWarriorWidgetProvider.kt b/android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/TaskWarriorWidgetProvider.kt
new file mode 100644
index 00000000..5662cd2a
--- /dev/null
+++ b/android/app/src/main/kotlin/com/ccextractor/taskwarriorflutter/TaskWarriorWidgetProvider.kt
@@ -0,0 +1,210 @@
+package com.ccextractor.taskwarriorflutter
+import android.annotation.TargetApi
+import android.appwidget.AppWidgetManager
+import android.content.Context
+import android.net.Uri
+import android.widget.RemoteViews
+import es.antonborri.home_widget.HomeWidgetBackgroundIntent
+import es.antonborri.home_widget.HomeWidgetLaunchIntent
+import es.antonborri.home_widget.HomeWidgetProvider
+import es.antonborri.home_widget.HomeWidgetPlugin
+import org.json.JSONException
+import android.content.Intent
+import android.widget.RemoteViewsService
+import org.json.JSONObject
+import org.json.JSONArray as OrgJSONArray
+import android.os.Bundle
+import android.app.PendingIntent
+import android.appwidget.AppWidgetProvider
+import android.os.Build
+
+
+@TargetApi(Build.VERSION_CODES.CUPCAKE)
+class TaskWarriorWidgetProvider : AppWidgetProvider() {
+
+ override fun onReceive(context: Context, intent: Intent) {
+ // val myaction = intent.action
+ if (intent.action == "TASK_ACTION") {
+ val extras = intent.extras
+ if(extras!=null){
+ val uuid = extras.getString("uuid")?:""
+ val add_task = extras.getString("launchedFor")
+ val host = if(add_task == "ADD_TASK"){context.getString(R.string.app_widget_add_clicked_uri)}else{context.getString(R.string.app_widget_card_clicked_uri)}
+ val launchIntent = Intent(context, MainActivity::class.java).apply {
+ action = context.getString(R.string.app_widget_launch_action)
+ data = Uri.parse("$host?uuid=$uuid")
+ flags = Intent. FLAG_ACTIVITY_NEW_TASK
+ context?.startActivity(this)
+ }
+ // HomeWidgetLaunchIntent.getActivity(context, MainActivity::class.java, Uri.parse("TaskWarrior://taskView?taskId=$uuid"))
+ }
+ }
+ super.onReceive(context, intent)
+ }
+ fun getLayoutId(context: Context) : Int{
+ val sharedPrefs = HomeWidgetPlugin.getData(context)
+ val theme = sharedPrefs.getString("themeMode", "")
+ val layoutId = if (theme.equals("dark")) {
+ R.layout.taskwarrior_layout_dark // Define a dark mode layout in your resources
+ } else {
+ R.layout.taskwarrior_layout
+ }
+ return layoutId
+ }
+ @TargetApi(Build.VERSION_CODES.DONUT)
+ override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
+ appWidgetIds.forEach { widgetId ->
+ val sharedPrefs = HomeWidgetPlugin.getData(context)
+ val tasks = sharedPrefs.getString("tasks", "")
+ val intent = Intent(context, ListViewRemoteViewsService::class.java).apply {
+ putExtra("tasksJsonString", tasks)
+ data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
+ }
+ val views = RemoteViews(context.packageName, getLayoutId(context)).apply {
+ val pendingIntent: PendingIntent = HomeWidgetLaunchIntent.getActivity(
+ context,
+ MainActivity::class.java
+ )
+ setOnClickPendingIntent(R.id.logo, pendingIntent)
+ val intent_for_add = Intent(context, TaskWarriorWidgetProvider::class.java).apply {
+ setAction("TASK_ACTION")
+ data=Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
+ putExtra("launchedFor", "ADD_TASK")
+ }
+ val pendingIntentAdd: PendingIntent = PendingIntent.getBroadcast(
+ context,
+ 0, // requestCode, can be any unique integer
+ intent_for_add,
+ PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT or Intent.FILL_IN_COMPONENT // Use appropriate flags
+ )
+ setOnClickPendingIntent(R.id.add_btn, pendingIntentAdd)
+ setRemoteAdapter(R.id.list_view, intent)
+ }
+
+ val clickPendingIntent: PendingIntent = Intent(
+ context,
+ TaskWarriorWidgetProvider::class.java
+ ).run {
+ setAction("TASK_ACTION")
+ setIdentifier("uuid")
+ data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
+
+ PendingIntent.getBroadcast(
+ context,
+ 0,
+ this,
+ PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT or Intent.FILL_IN_COMPONENT
+ )
+ }
+
+ views.setPendingIntentTemplate(R.id.list_view, clickPendingIntent)
+ appWidgetManager.updateAppWidget(widgetId, views)
+ }
+ super.onUpdate(context, appWidgetManager, appWidgetIds)
+ }
+ }
+class ListViewRemoteViewsFactory(
+ private val context: Context,
+ private val tasksJsonString: String?
+) : RemoteViewsService.RemoteViewsFactory {
+
+ private val tasks = mutableListOf()
+
+ override fun onCreate() {}
+
+ override fun onDataSetChanged() {
+ if (tasksJsonString != null) {
+ try {
+ val jsonArray = OrgJSONArray(tasksJsonString as String)
+ for (i in 0 until jsonArray.length()) {
+ tasks.add(Task.fromJson(jsonArray.getJSONObject(i)))
+ }
+ } catch (e: JSONException) {
+ e.printStackTrace()
+ }
+ }
+ }
+
+ override fun onDestroy() {}
+
+ override fun getCount(): Int = tasks.size
+
+ fun getListItemLayoutId(): Int{
+ val sharedPrefs = HomeWidgetPlugin.getData(context)
+ val theme = sharedPrefs.getString("themeMode", "")
+ val layoutId = if (theme.equals("dark")) {
+ R.layout.listitem_layout_dark // Define a dark mode layout in your resources
+ } else {
+ R.layout.listitem_layout
+ }
+ return layoutId
+ }
+ fun getListItemLayoutIdForR1(): Int{
+ val sharedPrefs = HomeWidgetPlugin.getData(context)
+ val theme = sharedPrefs.getString("themeMode", "")
+ val layoutId = if (theme.equals("dark")) {
+ R.layout.no_tasks_found_li_dark // Define a dark mode layout in your resources
+ } else {
+ R.layout.no_tasks_found_li
+ }
+ return layoutId
+ }
+ fun getDotIdByPriority(p: String) : Int{
+ println("PRIORITY: "+p)
+ if(p.equals("L")) return R.drawable.low_priority_dot
+ if(p.equals("M")) return R.drawable.mid_priority_dot
+ if(p.equals("H")) return R.drawable.high_priority_dot
+ return R.drawable.no_priority_dot
+ }
+
+ override fun getViewAt(position: Int): RemoteViews {
+ val task = tasks[position]
+ if(task.uuid.equals("NO_TASK"))
+ return RemoteViews(context.packageName, getListItemLayoutIdForR1()).apply {
+ if(task.priority.equals("1"))
+ setTextViewText(R.id.tv, "No tasks added yet")
+ if(task.priority.equals("2"))
+ setTextViewText(R.id.tv, "Filters applied are hiding all tasks")
+ }
+ return RemoteViews(context.packageName, getListItemLayoutId()).apply {
+ setTextViewText(R.id.todo__title, task.title)
+ setImageViewResource(R.id.dot, getDotIdByPriority(task.priority))
+ val a = Intent().apply {
+
+ Bundle().also { extras ->
+ extras.putString("action", "show_task")
+ extras.putString("uuid", tasks[position].uuid)
+ putExtras(extras)
+ }
+
+ }
+ setOnClickFillInIntent(R.id.list_item_container,a)
+ }
+
+ }
+ override fun getLoadingView(): RemoteViews? = null
+
+ override fun getViewTypeCount(): Int = 1
+
+ override fun getItemId(position: Int): Long = position.toLong()
+
+ override fun hasStableIds(): Boolean = true
+}
+class ListViewRemoteViewsService : RemoteViewsService() {
+
+ override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
+ val tasksJsonString = intent.getStringExtra("tasksJsonString")
+ return ListViewRemoteViewsFactory(applicationContext, tasksJsonString)
+ }
+}
+data class Task(val title: String, val urgencyLevel: String,val uuid:String, val priority: String) {
+ companion object {
+ fun fromJson(json: JSONObject): Task {
+ val title = json.optString("description", "")
+ val urgencyLevel = json.optString("urgency", "")
+ val uuid = json.optString("uuid","")
+ val priority = json.optString("priority", "")
+ return Task(title, urgencyLevel, uuid, priority)
+ }
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/example/taskwarrior/TaskWarriorWidgetProvider.kt b/android/app/src/main/kotlin/com/example/taskwarrior/TaskWarriorWidgetProvider.kt
deleted file mode 100644
index 0e04c4f5..00000000
--- a/android/app/src/main/kotlin/com/example/taskwarrior/TaskWarriorWidgetProvider.kt
+++ /dev/null
@@ -1,147 +0,0 @@
-package com.ccextractor.taskwarriorflutter
-import android.util.Log
-import android.appwidget.AppWidgetManager
-import android.content.Context
-import android.content.SharedPreferences
-import android.graphics.BitmapFactory
-import android.net.Uri
-import android.view.View
-import android.widget.RemoteViews
-import es.antonborri.home_widget.HomeWidgetBackgroundIntent
-import es.antonborri.home_widget.HomeWidgetLaunchIntent
-import es.antonborri.home_widget.HomeWidgetProvider
-import es.antonborri.home_widget.HomeWidgetPlugin
-import android.content.BroadcastReceiver
-import org.json.JSONException
-import android.content.Intent
-import android.widget.RemoteViewsService
-import org.json.JSONObject
-import org.json.JSONArray as OrgJSONArray
-import com.ccextractor.taskwarriorflutter.MainActivity
-import com.ccextractor.taskwarriorflutter.R
-import android.os.Bundle
-import android.app.PendingIntent
-import android.appwidget.AppWidgetProvider
-
-
-class TaskWarriorWidgetProvider : AppWidgetProvider() {
-
- override fun onReceive(context: Context, intent: Intent) {
- // val myaction = intent.action
- if (intent.action == "TASK_ACTION") {
- val extras = intent.extras
- if(extras!=null){
- val uuid = extras.getString("uuid")?:""
- val launchIntent = Intent(context, MainActivity::class.java).apply {
- action = context.getString(R.string.app_widget_launch_action)
- data = Uri.parse("${context.getString(R.string.app_widget_card_clicked_uri)}?uuid=$uuid")
- flags = Intent. FLAG_ACTIVITY_NEW_TASK
- context?.startActivity(this)
- }
- // HomeWidgetLaunchIntent.getActivity(context, MainActivity::class.java, Uri.parse("TaskWarrior://taskView?taskId=$uuid"))
- }
- }
- super.onReceive(context, intent)
- }
- override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
- appWidgetIds.forEach { widgetId ->
- val sharedPrefs = HomeWidgetPlugin.getData(context)
- val tasks = sharedPrefs.getString("tasks", "")
- val intent = Intent(context,ListViewRemoteViewsService::class.java).apply {
- putExtra("tasksJsonString", tasks)
- data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
- }
- val views = RemoteViews(context.packageName, R.layout.taskwarrior_layout).apply {
-
- val pendingIntent = HomeWidgetLaunchIntent.getActivity(
- context,
- MainActivity::class.java)
- setOnClickPendingIntent(R.id.container_layout, pendingIntent)
- setRemoteAdapter(R.id.list_view, intent)
-
- }
-
- val clickPendingIntent: PendingIntent = Intent(
- context,
- TaskWarriorWidgetProvider::class.java).run {
- setAction("TASK_ACTION")
- setIdentifier("uuid")
- data = Uri.parse(toUri(Intent.URI_INTENT_SCHEME))
-
- PendingIntent.getBroadcast(context,0,this,PendingIntent.FLAG_MUTABLE or PendingIntent.FLAG_UPDATE_CURRENT or Intent.FILL_IN_COMPONENT )
- }
- views.setPendingIntentTemplate(R.id.list_view,clickPendingIntent)
- appWidgetManager.updateAppWidget(widgetId, views)
- }
- super.onUpdate(context, appWidgetManager, appWidgetIds)
- }
- }
-class ListViewRemoteViewsFactory(
- private val context: Context,
- private val tasksJsonString: String?
-) : RemoteViewsService.RemoteViewsFactory {
-
- private val tasks = mutableListOf()
-
- override fun onCreate() {}
-
- override fun onDataSetChanged() {
- if (tasksJsonString != null) {
- try {
- val jsonArray = OrgJSONArray(tasksJsonString as String)
- for (i in 0 until jsonArray.length()) {
- tasks.add(Task.fromJson(jsonArray.getJSONObject(i)))
- }
- } catch (e: JSONException) {
- e.printStackTrace()
- }
- }
- }
-
- override fun onDestroy() {}
-
- override fun getCount(): Int = tasks.size
-
- override fun getViewAt(position: Int): RemoteViews {
- val task = tasks[position]
- return RemoteViews(context.packageName, R.layout.listitem_layout).apply {
- setTextViewText(R.id.title_textview, task.title)
- setTextViewText(R.id.urgency_textview, task.urgencyLevel)
- val a = Intent().apply {
-
- Bundle().also { extras ->
- extras.putString("uuid", "${tasks[position].uuid}")
- putExtras(extras)
- }
-
- }
- setOnClickFillInIntent(R.id.list_item_container,a)
-
- }
-
- }
- override fun getLoadingView(): RemoteViews? = null
-
- override fun getViewTypeCount(): Int = 1
-
- override fun getItemId(position: Int): Long = position.toLong()
-
- override fun hasStableIds(): Boolean = true
-}
-class ListViewRemoteViewsService : RemoteViewsService() {
-
- override fun onGetViewFactory(intent: Intent): RemoteViewsFactory {
- val tasksJsonString = intent.getStringExtra("tasksJsonString")
- return ListViewRemoteViewsFactory(applicationContext, tasksJsonString)
- }
-}
-data class Task(val title: String, val urgencyLevel: String,val uuid:String) {
- companion object {
- fun fromJson(json: JSONObject): Task {
- val title = json.optString("description", "")
- val urgencyLevel = json.optString("urgency", "")
- val uuid = json.optString("uuid","")
- return Task(title, urgencyLevel,uuid)
- }
- }
-}
\ No newline at end of file
diff --git a/android/app/src/main/res/drawable/add.xml b/android/app/src/main/res/drawable/add.xml
new file mode 100644
index 00000000..c322ed1c
--- /dev/null
+++ b/android/app/src/main/res/drawable/add.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/android/app/src/main/res/drawable/add_dark.xml b/android/app/src/main/res/drawable/add_dark.xml
new file mode 100644
index 00000000..74251df6
--- /dev/null
+++ b/android/app/src/main/res/drawable/add_dark.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/android/app/src/main/res/drawable/bg_button_add.xml b/android/app/src/main/res/drawable/bg_button_add.xml
new file mode 100644
index 00000000..79c8ede0
--- /dev/null
+++ b/android/app/src/main/res/drawable/bg_button_add.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/bg_button_add_dark.xml b/android/app/src/main/res/drawable/bg_button_add_dark.xml
new file mode 100644
index 00000000..4b97c721
--- /dev/null
+++ b/android/app/src/main/res/drawable/bg_button_add_dark.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/border_style.xml b/android/app/src/main/res/drawable/border_style.xml
index 34b6ad89..a760078d 100644
--- a/android/app/src/main/res/drawable/border_style.xml
+++ b/android/app/src/main/res/drawable/border_style.xml
@@ -1,7 +1,16 @@
-
-
-
-
-
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/drawable/border_style_dark.xml b/android/app/src/main/res/drawable/border_style_dark.xml
new file mode 100644
index 00000000..b492555c
--- /dev/null
+++ b/android/app/src/main/res/drawable/border_style_dark.xml
@@ -0,0 +1,16 @@
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/drawable/down_btn_icon.xml b/android/app/src/main/res/drawable/down_btn_icon.xml
new file mode 100644
index 00000000..bf9aa923
--- /dev/null
+++ b/android/app/src/main/res/drawable/down_btn_icon.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/android/app/src/main/res/drawable/down_btn_icon_dark.xml b/android/app/src/main/res/drawable/down_btn_icon_dark.xml
new file mode 100644
index 00000000..4a2f4f6b
--- /dev/null
+++ b/android/app/src/main/res/drawable/down_btn_icon_dark.xml
@@ -0,0 +1,10 @@
+
+
+
diff --git a/android/app/src/main/res/drawable/high_priority_dot.xml b/android/app/src/main/res/drawable/high_priority_dot.xml
new file mode 100644
index 00000000..2e6506e3
--- /dev/null
+++ b/android/app/src/main/res/drawable/high_priority_dot.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/low_priority_dot.xml b/android/app/src/main/res/drawable/low_priority_dot.xml
new file mode 100644
index 00000000..baf70648
--- /dev/null
+++ b/android/app/src/main/res/drawable/low_priority_dot.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/mid_priority_dot.xml b/android/app/src/main/res/drawable/mid_priority_dot.xml
new file mode 100644
index 00000000..6407db39
--- /dev/null
+++ b/android/app/src/main/res/drawable/mid_priority_dot.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/no_priority_dot.xml b/android/app/src/main/res/drawable/no_priority_dot.xml
new file mode 100644
index 00000000..e656e3d6
--- /dev/null
+++ b/android/app/src/main/res/drawable/no_priority_dot.xml
@@ -0,0 +1,20 @@
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/preview.png b/android/app/src/main/res/drawable/preview.png
index 3eeeecd6..5f32f708 100644
Binary files a/android/app/src/main/res/drawable/preview.png and b/android/app/src/main/res/drawable/preview.png differ
diff --git a/android/app/src/main/res/drawable/taskwarrior_widget_icon.png b/android/app/src/main/res/drawable/taskwarrior_widget_icon.png
new file mode 100644
index 00000000..06fcb3df
Binary files /dev/null and b/android/app/src/main/res/drawable/taskwarrior_widget_icon.png differ
diff --git a/android/app/src/main/res/drawable/taskwarrior_widget_icon_dark.png b/android/app/src/main/res/drawable/taskwarrior_widget_icon_dark.png
new file mode 100644
index 00000000..f28c15bf
Binary files /dev/null and b/android/app/src/main/res/drawable/taskwarrior_widget_icon_dark.png differ
diff --git a/android/app/src/main/res/layout/listitem_layout.xml b/android/app/src/main/res/layout/listitem_layout.xml
index 8beba106..a64d2523 100644
--- a/android/app/src/main/res/layout/listitem_layout.xml
+++ b/android/app/src/main/res/layout/listitem_layout.xml
@@ -2,30 +2,25 @@
+ android:layout_height="match_parent"
+ android:orientation="horizontal">
-
-
+
-
-
-
+ android:scrollHorizontally="true"
+ android:ellipsize="end"
+ android:maxLines="1"
+ android:id="@+id/todo__title"
+ android:layout_width="fill_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:paddingHorizontal="5dp"
+ android:textColor="@color/fg"/>
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/listitem_layout_dark.xml b/android/app/src/main/res/layout/listitem_layout_dark.xml
new file mode 100644
index 00000000..7c221b2c
--- /dev/null
+++ b/android/app/src/main/res/layout/listitem_layout_dark.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/no_tasks_found_li.xml b/android/app/src/main/res/layout/no_tasks_found_li.xml
new file mode 100644
index 00000000..32246c84
--- /dev/null
+++ b/android/app/src/main/res/layout/no_tasks_found_li.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/no_tasks_found_li_dark.xml b/android/app/src/main/res/layout/no_tasks_found_li_dark.xml
new file mode 100644
index 00000000..bbc37495
--- /dev/null
+++ b/android/app/src/main/res/layout/no_tasks_found_li_dark.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/taskwarrior_layout.xml b/android/app/src/main/res/layout/taskwarrior_layout.xml
index 63137f09..775b32b2 100644
--- a/android/app/src/main/res/layout/taskwarrior_layout.xml
+++ b/android/app/src/main/res/layout/taskwarrior_layout.xml
@@ -1,43 +1,66 @@
-
-
-
-
-
-
-
-
-
-
-
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/layout/taskwarrior_layout_dark.xml b/android/app/src/main/res/layout/taskwarrior_layout_dark.xml
new file mode 100644
index 00000000..b23fc384
--- /dev/null
+++ b/android/app/src/main/res/layout/taskwarrior_layout_dark.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
index b2bffa8d..22648051 100644
--- a/android/app/src/main/res/values/colors.xml
+++ b/android/app/src/main/res/values/colors.xml
@@ -1,6 +1,20 @@
- #FFE1F5FE
- #FF81D4FA
- #FF039BE5
- #FF01579B
+ #000000
+ #FFFFFF
+ #000
+ #fff
+ #000
+ #4D4D4D
+ #efefef
+ #FFFFFF
+ #000000
+ #FFFFFF
+ #2C2C2C
+ #FFFFFF
+ #787878
+ #4D4D4D
+ #FF0000
+ #FFF200
+ #00FF42
+ #A2A2A2
\ No newline at end of file
diff --git a/android/app/src/main/res/values/dimens.xml b/android/app/src/main/res/values/dimens.xml
index 4db8c590..40496e00 100644
--- a/android/app/src/main/res/values/dimens.xml
+++ b/android/app/src/main/res/values/dimens.xml
@@ -6,5 +6,6 @@ Refer to App Widget Documentation for margin information
http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
-->
0dp
-
+ 40dp
+ 15dp
\ No newline at end of file
diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml
index 1989514f..ff9b9745 100644
--- a/android/app/src/main/res/values/strings.xml
+++ b/android/app/src/main/res/values/strings.xml
@@ -7,8 +7,11 @@
imageData
es.antonborri.home_widget.action.LAUNCH
taskwarriorappwidget://cardclicked
+ taskwarriorappwidget://addclicked
This widget shows pending tasks from TaskWarrior app
TaskWarrior
Add widget
-
+ Task List
+ add_task
+ No Tasks available
\ No newline at end of file
diff --git a/android/app/src/main/res/xml/taskwarriorconfig.xml b/android/app/src/main/res/xml/taskwarriorconfig.xml
index e3aca793..1a5d2c7f 100644
--- a/android/app/src/main/res/xml/taskwarriorconfig.xml
+++ b/android/app/src/main/res/xml/taskwarriorconfig.xml
@@ -1,8 +1,8 @@
> getUniqueProjects() async {
@@ -552,6 +571,10 @@ class HomeController extends GetxController {
void initLanguageAndDarkMode() {
isDarkModeOn.value = AppSettings.isDarkMode;
selectedLanguage.value = AppSettings.selectedLanguage;
+ HomeWidget.saveWidgetData("themeMode", AppSettings.isDarkMode ? "dark" : "light");
+ HomeWidget.updateWidget(
+ androidName: "TaskWarriorWidgetProvider"
+ );
// print("called and value is${isDarkModeOn.value}");
}
@@ -645,7 +668,6 @@ class HomeController extends GetxController {
},
);
}
-
late RxString uuid = "".obs;
late RxBool isHomeWidgetTaskTapped = false.obs;
@@ -661,6 +683,7 @@ class HomeController extends GetxController {
});
}
}
+ debugPrint('${myUri.toString()} URI WIDGET CLICKED');
}
HomeWidget.widgetClicked.listen((uri) async {
if (uri != null) {
@@ -671,8 +694,15 @@ class HomeController extends GetxController {
}
debugPrint('uuid is $uuid');
Get.toNamed(Routes.DETAIL_ROUTE, arguments: ["uuid", uuid.value]);
+ }else if(uri.host == "addclicked"){
+ showAddDialogAfterWidgetClick();
}
}
+
});
}
+ void showAddDialogAfterWidgetClick() {
+ Widget showDialog = taskchampion.value ? AddTaskToTaskcBottomSheet(homeController: this) : AddTaskBottomSheet(homeController: this);
+ Get.dialog(showDialog);
+ }
}
diff --git a/lib/app/modules/home/controllers/widget.controller.dart b/lib/app/modules/home/controllers/widget.controller.dart
index a618564f..61ca0e47 100644
--- a/lib/app/modules/home/controllers/widget.controller.dart
+++ b/lib/app/modules/home/controllers/widget.controller.dart
@@ -17,12 +17,9 @@ import 'package:taskwarrior/app/utils/taskfunctions/urgency.dart';
// import 'package:taskwarrior/widgets/taskfunctions/datetime_differences.dart';
class WidgetController extends GetxController {
- final BuildContext? context;
- WidgetController(this.context);
final HomeController storageWidget = Get.find();
late Storage storage;
- late final Filters filters;
- RxList taskData = [].obs; // Use RxList for observable list
+ late final Filters filters; // Use RxList for observable list
List dailyBurnDown = [];
Directory? baseDirectory;
RxList allData = [].obs; // Use RxList for observable list
@@ -33,7 +30,6 @@ class WidgetController extends GetxController {
// storageWidget = StorageWidget.of(context!); // Use Get.context from GetX
// var currentProfile = ProfilesWidget.of(context!).currentProfile;
var currentProfile = Get.find().currentProfile.value;
-
baseDirectory = Get.find().baseDirectory();
storage =
Storage(Directory('${baseDirectory!.path}/profiles/$currentProfile'));
@@ -41,30 +37,102 @@ class WidgetController extends GetxController {
sendAndUpdate();
}
}
-
Future sendAndUpdate() async {
await sendData();
await updateWidget();
}
-
+
Future sendData() async {
- int i = 1;
+ final HomeController taskController = Get.find();
+ int lengthBeforeFilters = allData.length;
+ List tasks = allData;
+ debugPrint('Tasks: ${tasks.length}, ${taskController.projectFilter}, ${taskController.pendingFilter.value}, ${taskController.selectedSort.value}');
+ if (taskController.projectFilter.value != 'All Projects'&&taskController.projectFilter.toString().isNotEmpty) {
+ tasks = tasks.where((task) => task.project == taskController.projectFilter.value).toList();
+ } else {
+ tasks = List.from(tasks);
+ }
+
+ // Apply other filters and sorting
+ tasks.sort((a, b) => a.id!.compareTo(b.id!));
+
+ tasks = tasks.where((task) {
+ if (taskController.pendingFilter.value) {
+ return task.status == 'pending';
+ } else {
+ return task.status == 'completed';
+ }
+ }).toList();
+
+ tasks = tasks.where((task) {
+ var tags = task.tags?.toSet() ?? {};
+ if (taskController.tagUnion.value) {
+ if (taskController.selectedTags.isEmpty) {
+ return true;
+ }
+ return taskController.selectedTags.any((tag) => (tag.startsWith('+'))
+ ? tags.contains(tag.substring(1))
+ : !tags.contains(tag.substring(1)));
+ } else {
+ return taskController.selectedTags.every((tag) => (tag.startsWith('+'))
+ ? tags.contains(tag.substring(1))
+ : !tags.contains(tag.substring(1)));
+ }
+ }).toList();
+
+ // Apply sorting based on selectedSort
+ tasks.sort((a, b) {
+ switch (taskController.selectedSort.value) {
+ case 'Created+':
+ return a.entry.compareTo(b.entry);
+ case 'Created-':
+ return b.entry.compareTo(a.entry);
+ case 'Modified+':
+ return a.modified!.compareTo(b.modified!);
+ case 'Modified-':
+ return b.modified!.compareTo(a.modified!);
+ case 'Due till+':
+ return a.due!.compareTo(b.due!);
+ case 'Due till-':
+ return b.due!.compareTo(a.due!);
+ case 'Priority-':
+ return a.priority!.compareTo(b.priority!);
+ case 'Priority+':
+ return b.priority!.compareTo(a.priority!);
+ case 'Project+':
+ return a.project!.compareTo(b.project!);
+ case 'Project-':
+ return b.project!.compareTo(a.project!);
+ case 'Urgency-':
+ return b.urgency!.compareTo(a.urgency!);
+ case 'Urgency+':
+ return a.urgency!.compareTo(b.urgency!);
+ default:
+ return 0;
+ }
+ });
List