update some views at toggling all-day task
This commit is contained in:
parent
2c74fbe68f
commit
39a5283a97
|
@ -565,7 +565,7 @@ class EventActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun handleNotificationAvailability(callback: () -> Unit) {
|
||||
if (NotificationManagerCompat.from(applicationContext).areNotificationsEnabled()) {
|
||||
if (NotificationManagerCompat.from(this).areNotificationsEnabled()) {
|
||||
callback()
|
||||
} else {
|
||||
ConfirmationDialog(this, messageId = R.string.notifications_disabled, positive = R.string.ok, negative = 0) {
|
||||
|
@ -642,7 +642,7 @@ class EventActivity : SimpleActivity() {
|
|||
mRepeatLimit > 0 -> {
|
||||
event_repetition_limit_label.text = getString(R.string.repeat_till)
|
||||
val repeatLimitDateTime = Formatter.getDateTimeFromTS(mRepeatLimit)
|
||||
Formatter.getFullDate(applicationContext, repeatLimitDateTime)
|
||||
Formatter.getFullDate(this, repeatLimitDateTime)
|
||||
}
|
||||
else -> {
|
||||
event_repetition_limit_label.text = getString(R.string.repeat)
|
||||
|
@ -1263,7 +1263,7 @@ class EventActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun updateStartDateText() {
|
||||
event_start_date.text = Formatter.getDate(applicationContext, mEventStartDateTime)
|
||||
event_start_date.text = Formatter.getDate(this, mEventStartDateTime)
|
||||
checkStartEndValidity()
|
||||
}
|
||||
|
||||
|
@ -1278,7 +1278,7 @@ class EventActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun updateEndDateText() {
|
||||
event_end_date.text = Formatter.getDate(applicationContext, mEventEndDateTime)
|
||||
event_end_date.text = Formatter.getDate(this, mEventEndDateTime)
|
||||
checkStartEndValidity()
|
||||
}
|
||||
|
||||
|
@ -1554,7 +1554,7 @@ class EventActivity : SimpleActivity() {
|
|||
|
||||
val placeholder = BitmapDrawable(resources, SimpleContactsHelper(context).getContactLetterIcon(event_contact_name.value))
|
||||
event_contact_image.apply {
|
||||
attendee.updateImage(applicationContext, this, placeholder)
|
||||
attendee.updateImage(this@EventActivity, this, placeholder)
|
||||
beVisible()
|
||||
}
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ 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.Formatter
|
||||
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 com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.mydebug
|
||||
import kotlinx.android.synthetic.main.activity_task.*
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class TaskActivity : SimpleActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -23,8 +23,8 @@ class TaskActivity : SimpleActivity() {
|
|||
|
||||
val intent = intent ?: return
|
||||
val taskId = intent.getLongExtra(TASK_ID, 0L)
|
||||
setupNewTask()
|
||||
updateColors()
|
||||
gotTask()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
@ -32,12 +32,28 @@ class TaskActivity : SimpleActivity() {
|
|||
return true
|
||||
}
|
||||
|
||||
private fun gotTask() {
|
||||
task_all_day.setOnCheckedChangeListener { compoundButton, isChecked -> toggleAllDay(isChecked) }
|
||||
task_all_day_holder.setOnClickListener {
|
||||
task_all_day.toggle()
|
||||
}
|
||||
|
||||
task_start_date.text = Formatter.getDate(this, DateTime.now())
|
||||
task_start_time.text = Formatter.getTime(this, DateTime.now())
|
||||
setupNewTask()
|
||||
}
|
||||
|
||||
private fun setupNewTask() {
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE)
|
||||
task_title.requestFocus()
|
||||
updateActionBarTitle(getString(R.string.new_task))
|
||||
}
|
||||
|
||||
private fun toggleAllDay(isChecked: Boolean) {
|
||||
hideKeyboard()
|
||||
task_start_time.beGoneIf(isChecked)
|
||||
}
|
||||
|
||||
private fun updateColors() {
|
||||
updateTextColors(task_scrollview)
|
||||
task_time_image.applyColorFilter(config.textColor)
|
||||
|
|
Loading…
Reference in New Issue