From 2c74fbe68fc0f201873414fcc63dd19dfa062934 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 21 Feb 2022 22:53:16 +0100 Subject: [PATCH] adding some views into Task Activity --- app/src/main/AndroidManifest.xml | 2 + .../calendar/pro/activities/TaskActivity.kt | 23 +++++ .../calendar/pro/helpers/Constants.kt | 1 + app/src/main/res/layout/activity_task.xml | 88 +++++++++++++++++++ 4 files changed, 114 insertions(+) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 044bfc92c..7c65a8851 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -120,6 +120,7 @@ @@ -141,6 +142,7 @@ diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt index da7440f31..3ca7742d1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt @@ -2,8 +2,15 @@ package com.simplemobiletools.calendar.pro.activities import android.os.Bundle import android.view.Menu +import android.view.WindowManager import com.simplemobiletools.calendar.pro.R +import com.simplemobiletools.calendar.pro.extensions.config +import com.simplemobiletools.calendar.pro.helpers.TASK_ID +import com.simplemobiletools.commons.extensions.applyColorFilter import com.simplemobiletools.commons.extensions.checkAppSideloading +import com.simplemobiletools.commons.extensions.updateActionBarTitle +import com.simplemobiletools.commons.extensions.updateTextColors +import kotlinx.android.synthetic.main.activity_task.* class TaskActivity : SimpleActivity() { override fun onCreate(savedInstanceState: Bundle?) { @@ -13,10 +20,26 @@ class TaskActivity : SimpleActivity() { if (checkAppSideloading()) { return } + + val intent = intent ?: return + val taskId = intent.getLongExtra(TASK_ID, 0L) + setupNewTask() + updateColors() } override fun onCreateOptionsMenu(menu: Menu): Boolean { updateMenuItemColors(menu, true) return true } + + private fun setupNewTask() { + window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) + task_title.requestFocus() + updateActionBarTitle(getString(R.string.new_task)) + } + + private fun updateColors() { + updateTextColors(task_scrollview) + task_time_image.applyColorFilter(config.textColor) + } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index 2474a4958..780cb8d92 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -8,6 +8,7 @@ const val SCHEDULE_CALDAV_REQUEST_CODE = 10000 const val DAY_CODE = "day_code" const val YEAR_LABEL = "year" const val EVENT_ID = "event_id" +const val TASK_ID = "task_id" const val IS_DUPLICATE_INTENT = "is_duplicate_intent" const val EVENT_OCCURRENCE_TS = "event_occurrence_ts" const val NEW_EVENT_START_TS = "new_event_start_ts" diff --git a/app/src/main/res/layout/activity_task.xml b/app/src/main/res/layout/activity_task.xml index 1013e2a91..526cabf8f 100644 --- a/app/src/main/res/layout/activity_task.xml +++ b/app/src/main/res/layout/activity_task.xml @@ -1,5 +1,6 @@ @@ -24,5 +25,92 @@ android:textCursorDrawable="@null" android:textSize="@dimen/day_text_size" /> + + + + + + + + + + + + + + + +