mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-25 07:50:56 +01:00
use images instead of text at reminder types
This commit is contained in:
parent
949105dce9
commit
33e8f7ba6f
@ -9,6 +9,7 @@ import android.text.method.LinkMovementMethod
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import androidx.core.app.NotificationManagerCompat
|
||||
import com.simplemobiletools.calendar.pro.R
|
||||
import com.simplemobiletools.calendar.pro.dialogs.*
|
||||
@ -23,7 +24,6 @@ import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.views.MyTextView
|
||||
import kotlinx.android.synthetic.main.activity_event.*
|
||||
import kotlinx.android.synthetic.main.activity_event.view.*
|
||||
import org.joda.time.DateTime
|
||||
@ -154,21 +154,21 @@ class EventActivity : SimpleActivity() {
|
||||
event_reminder_1_type.setOnClickListener {
|
||||
showReminderTypePicker(mReminder1Type) {
|
||||
mReminder1Type = it
|
||||
updateReminderTypeText(event_reminder_1_type, mReminder1Type)
|
||||
updateReminderTypeImage(event_reminder_1_type, mReminder1Type)
|
||||
}
|
||||
}
|
||||
|
||||
event_reminder_2_type.setOnClickListener {
|
||||
showReminderTypePicker(mReminder2Type) {
|
||||
mReminder2Type = it
|
||||
updateReminderTypeText(event_reminder_2_type, mReminder2Type)
|
||||
updateReminderTypeImage(event_reminder_2_type, mReminder2Type)
|
||||
}
|
||||
}
|
||||
|
||||
event_reminder_3_type.setOnClickListener {
|
||||
showReminderTypePicker(mReminder3Type) {
|
||||
mReminder3Type = it
|
||||
updateReminderTypeText(event_reminder_3_type, mReminder3Type)
|
||||
updateReminderTypeImage(event_reminder_3_type, mReminder3Type)
|
||||
}
|
||||
}
|
||||
|
||||
@ -593,10 +593,7 @@ class EventActivity : SimpleActivity() {
|
||||
|
||||
private fun updateReminder1Text() {
|
||||
event_reminder_1.text = getFormattedMinutes(mReminder1Minutes)
|
||||
event_reminder_1_type.apply {
|
||||
beVisibleIf(mReminder1Minutes != REMINDER_OFF)
|
||||
text = getString(R.string.notification)
|
||||
}
|
||||
event_reminder_1_type.beVisibleIf(mReminder1Minutes != REMINDER_OFF)
|
||||
}
|
||||
|
||||
private fun updateReminder2Text() {
|
||||
@ -611,10 +608,7 @@ class EventActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
event_reminder_2_type.apply {
|
||||
beVisibleIf(mReminder2Minutes != REMINDER_OFF)
|
||||
text = getString(R.string.notification)
|
||||
}
|
||||
event_reminder_2_type.beVisibleIf(mReminder2Minutes != REMINDER_OFF)
|
||||
}
|
||||
|
||||
private fun updateReminder3Text() {
|
||||
@ -629,10 +623,7 @@ class EventActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
event_reminder_3_type.apply {
|
||||
beVisibleIf(mReminder3Minutes != REMINDER_OFF)
|
||||
text = getString(R.string.notification)
|
||||
}
|
||||
event_reminder_3_type.beVisibleIf(mReminder3Minutes != REMINDER_OFF)
|
||||
}
|
||||
|
||||
private fun showReminderTypePicker(currentValue: Int, callback: (Int) -> Unit) {
|
||||
@ -646,14 +637,15 @@ class EventActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun updateReminderTypeTexts() {
|
||||
updateReminderTypeText(event_reminder_1_type, mReminder1Type)
|
||||
updateReminderTypeText(event_reminder_2_type, mReminder2Type)
|
||||
updateReminderTypeText(event_reminder_3_type, mReminder3Type)
|
||||
updateReminderTypeImage(event_reminder_1_type, mReminder1Type)
|
||||
updateReminderTypeImage(event_reminder_2_type, mReminder2Type)
|
||||
updateReminderTypeImage(event_reminder_3_type, mReminder3Type)
|
||||
}
|
||||
|
||||
private fun updateReminderTypeText(view: MyTextView, type: Int) {
|
||||
val text = getString(if (type == REMINDER_NOTIFICATION) R.string.notification else R.string.email)
|
||||
view.text = text
|
||||
private fun updateReminderTypeImage(view: ImageView, type: Int) {
|
||||
val drawable = if (type == REMINDER_NOTIFICATION) R.drawable.ic_bell else R.drawable.ic_email
|
||||
val icon = resources.getColoredDrawableWithColor(drawable, config.textColor)
|
||||
view.setImageDrawable(icon)
|
||||
}
|
||||
|
||||
private fun updateRepetitionText() {
|
||||
@ -1095,5 +1087,8 @@ class EventActivity : SimpleActivity() {
|
||||
event_type_image.applyColorFilter(textColor)
|
||||
event_caldav_calendar_image.applyColorFilter(textColor)
|
||||
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor())
|
||||
event_reminder_1_type.applyColorFilter(textColor)
|
||||
event_reminder_2_type.applyColorFilter(textColor)
|
||||
event_reminder_3_type.applyColorFilter(textColor)
|
||||
}
|
||||
}
|
||||
|
@ -197,17 +197,18 @@
|
||||
android:textSize="@dimen/day_text_size"
|
||||
tools:text="@string/add_another_reminder"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
<ImageView
|
||||
android:id="@+id/event_reminder_1_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/event_date_time_divider"
|
||||
android:layout_alignTop="@+id/event_reminder_1"
|
||||
android:layout_alignBottom="@+id/event_reminder_1"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:alpha="0.8"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/day_text_size"
|
||||
tools:text="@string/notification"/>
|
||||
android:src="@drawable/ic_bell"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/event_reminder_2"
|
||||
@ -227,17 +228,18 @@
|
||||
android:visibility="gone"
|
||||
tools:text="@string/add_another_reminder"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
<ImageView
|
||||
android:id="@+id/event_reminder_2_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/event_reminder_1"
|
||||
android:layout_alignTop="@+id/event_reminder_2"
|
||||
android:layout_alignBottom="@+id/event_reminder_2"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:alpha="0.8"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/day_text_size"
|
||||
tools:text="@string/notification"/>
|
||||
android:src="@drawable/ic_bell"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/event_reminder_3"
|
||||
@ -257,17 +259,18 @@
|
||||
android:visibility="gone"
|
||||
tools:text="@string/add_another_reminder"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
<ImageView
|
||||
android:id="@+id/event_reminder_3_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/event_reminder_2"
|
||||
android:layout_alignTop="@+id/event_reminder_3"
|
||||
android:layout_alignBottom="@+id/event_reminder_3"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:alpha="0.8"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:textSize="@dimen/day_text_size"
|
||||
tools:text="@string/notification"/>
|
||||
android:src="@drawable/ic_bell"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/event_reminder_divider"
|
||||
|
Loading…
Reference in New Issue
Block a user