adding some views into Task Activity

This commit is contained in:
tibbi 2022-02-21 22:53:16 +01:00
parent 18d6b044ea
commit 2c74fbe68f
4 changed files with 114 additions and 0 deletions

View File

@ -120,6 +120,7 @@
<activity
android:name=".activities.EventActivity"
android:launchMode="singleTask"
android:label="@string/new_event"
android:parentActivityName=".activities.MainActivity">
<intent-filter>
@ -141,6 +142,7 @@
<activity
android:name=".activities.TaskActivity"
android:label="@string/new_task"
android:launchMode="singleTask"
android:parentActivityName=".activities.MainActivity" />

View File

@ -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)
}
}

View File

@ -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"

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/task_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -24,5 +25,92 @@
android:textCursorDrawable="@null"
android:textSize="@dimen/day_text_size" />
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/task_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/task_title"
android:layout_marginStart="@dimen/activity_margin"
android:layout_marginTop="@dimen/activity_margin"
android:layout_marginEnd="@dimen/activity_margin"
android:autoLink="all"
android:gravity="top"
android:hint="@string/description"
android:inputType="textCapSentences|textMultiLine"
android:linksClickable="true"
android:minEms="20"
android:textCursorDrawable="@null"
android:textSize="@dimen/day_text_size" />
<ImageView
android:id="@+id/task_description_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/task_description"
android:layout_marginTop="@dimen/activity_margin"
android:layout_marginBottom="@dimen/normal_margin"
android:background="@color/divider_grey"
android:importantForAccessibility="no" />
<ImageView
android:id="@+id/task_time_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/task_description_divider"
android:layout_alignTop="@+id/task_all_day_holder"
android:layout_alignBottom="@+id/task_all_day_holder"
android:layout_marginStart="@dimen/normal_margin"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_clock_vector" />
<RelativeLayout
android:id="@+id/task_all_day_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/task_description_divider"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/small_margin"
android:layout_toEndOf="@+id/task_time_image"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/normal_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/normal_margin">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/task_all_day"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:layoutDirection="rtl"
android:text="@string/all_day"
android:textSize="@dimen/day_text_size" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/task_start_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/task_time_image"
android:layout_alignStart="@+id/task_all_day_holder"
android:background="?attr/selectableItemBackground"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:textSize="@dimen/day_text_size"
tools:text="January 1 1970" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/task_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/task_time_image"
android:layout_alignParentEnd="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:textSize="@dimen/day_text_size"
tools:text="00:00" />
</RelativeLayout>
</ScrollView>