allow hiding the description or location from the event list
This commit is contained in:
parent
f146f3d88c
commit
935fe351af
8 changed files with 50 additions and 4 deletions
|
@ -63,7 +63,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:bfa17fd2d4'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:3b96b27e70'
|
||||
implementation 'joda-time:joda-time:2.10.3'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
|
||||
|
|
|
@ -54,6 +54,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupHighlightWeekends()
|
||||
setupHighlightWeekendsColor()
|
||||
setupDeleteAllEvents()
|
||||
setupDisplayDescription()
|
||||
setupReplaceDescription()
|
||||
setupWeekNumbers()
|
||||
setupShowGrid()
|
||||
|
@ -391,6 +392,25 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupDisplayDescription() {
|
||||
settings_display_description.isChecked = config.displayDescription
|
||||
setupDescriptionVisibility()
|
||||
settings_display_description_holder.setOnClickListener {
|
||||
settings_display_description.toggle()
|
||||
config.displayDescription = settings_display_description.isChecked
|
||||
setupDescriptionVisibility()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupDescriptionVisibility() {
|
||||
settings_replace_description_holder.beVisibleIf(config.displayDescription)
|
||||
if (settings_replace_description_holder.isVisible()) {
|
||||
settings_display_description_holder.background = resources.getDrawable(R.drawable.ripple_background, theme)
|
||||
} else {
|
||||
settings_display_description_holder.background = resources.getDrawable(R.drawable.ripple_bottom_corners, theme)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupReplaceDescription() {
|
||||
settings_replace_description.isChecked = config.replaceDescription
|
||||
settings_replace_description_holder.setOnClickListener {
|
||||
|
@ -831,6 +851,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
put(FONT_SIZE, config.fontSize)
|
||||
put(LIST_WIDGET_VIEW_TO_OPEN, config.listWidgetViewToOpen)
|
||||
put(REMINDER_AUDIO_STREAM, config.reminderAudioStream)
|
||||
put(DISPLAY_DESCRIPTION, config.displayDescription)
|
||||
put(REPLACE_DESCRIPTION, config.replaceDescription)
|
||||
put(SHOW_GRID, config.showGrid)
|
||||
put(LOOP_REMINDERS, config.loopReminders)
|
||||
|
@ -927,6 +948,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
FONT_SIZE -> config.fontSize = value.toInt()
|
||||
LIST_WIDGET_VIEW_TO_OPEN -> config.listWidgetViewToOpen = value.toInt()
|
||||
REMINDER_AUDIO_STREAM -> config.reminderAudioStream = value.toInt()
|
||||
DISPLAY_DESCRIPTION -> config.displayDescription = value.toBoolean()
|
||||
REPLACE_DESCRIPTION -> config.replaceDescription = value.toBoolean()
|
||||
SHOW_GRID -> config.showGrid = value.toBoolean()
|
||||
LOOP_REMINDERS -> config.loopReminders = value.toBoolean()
|
||||
|
|
|
@ -25,6 +25,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
|||
MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
||||
|
||||
private val allDayString = resources.getString(R.string.all_day)
|
||||
private val displayDescription = activity.config.displayDescription
|
||||
private val replaceDescriptionWithLocation = activity.config.replaceDescription
|
||||
private val dimPastEvents = activity.config.dimPastEvents
|
||||
private var isPrintVersion = false
|
||||
|
@ -89,7 +90,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
|
|||
}
|
||||
|
||||
event_item_description.text = if (replaceDescriptionWithLocation) event.location else event.description
|
||||
event_item_description.beVisibleIf(event_item_description.text.isNotEmpty())
|
||||
event_item_description.beVisibleIf(displayDescription && event_item_description.text.isNotEmpty())
|
||||
event_item_color_bar.background.applyColorFilter(event.color)
|
||||
|
||||
var newTextColor = textColor
|
||||
|
|
|
@ -34,6 +34,7 @@ class EventListAdapter(
|
|||
) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) {
|
||||
|
||||
private val allDayString = resources.getString(R.string.all_day)
|
||||
private val displayDescription = activity.config.displayDescription
|
||||
private val replaceDescription = activity.config.replaceDescription
|
||||
private val dimPastEvents = activity.config.dimPastEvents
|
||||
private val now = getNowSeconds()
|
||||
|
@ -147,7 +148,7 @@ class EventListAdapter(
|
|||
}
|
||||
|
||||
event_item_description.text = if (replaceDescription) listEvent.location else listEvent.description
|
||||
event_item_description.beVisibleIf(event_item_description.text.isNotEmpty())
|
||||
event_item_description.beVisibleIf(displayDescription && event_item_description.text.isNotEmpty())
|
||||
event_item_color_bar.background.applyColorFilter(listEvent.color)
|
||||
|
||||
var newTextColor = textColor
|
||||
|
|
|
@ -26,6 +26,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
|||
private var events = ArrayList<ListItem>()
|
||||
private var textColor = context.config.widgetTextColor
|
||||
private var weakTextColor = textColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
private val displayDescription = context.config.displayDescription
|
||||
private val replaceDescription = context.config.replaceDescription
|
||||
private val dimPastEvents = context.config.dimPastEvents
|
||||
private var mediumFontSize = context.getWidgetFontSize()
|
||||
|
@ -77,7 +78,7 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
|||
|
||||
// we cannot change the event_item_color_bar rules dynamically, so do it like this
|
||||
val descriptionText = if (replaceDescription) item.location else item.description
|
||||
if (descriptionText.isNotEmpty()) {
|
||||
if (displayDescription && descriptionText.isNotEmpty()) {
|
||||
setText(R.id.event_item_time, "$timeText\n$descriptionText")
|
||||
}
|
||||
|
||||
|
|
|
@ -121,6 +121,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getBoolean(REPLACE_DESCRIPTION, false)
|
||||
set(replaceDescription) = prefs.edit().putBoolean(REPLACE_DESCRIPTION, replaceDescription).apply()
|
||||
|
||||
var displayDescription: Boolean
|
||||
get() = prefs.getBoolean(DISPLAY_DESCRIPTION, true)
|
||||
set(displayDescription) = prefs.edit().putBoolean(DISPLAY_DESCRIPTION, displayDescription).apply()
|
||||
|
||||
var showGrid: Boolean
|
||||
get() = prefs.getBoolean(SHOW_GRID, false)
|
||||
set(showGrid) = prefs.edit().putBoolean(SHOW_GRID, showGrid).apply()
|
||||
|
|
|
@ -68,6 +68,7 @@ const val CALDAV_SYNCED_CALENDAR_IDS = "caldav_synced_calendar_ids"
|
|||
const val LAST_USED_CALDAV_CALENDAR = "last_used_caldav_calendar"
|
||||
const val LAST_USED_LOCAL_EVENT_TYPE_ID = "last_used_local_event_type_id"
|
||||
const val DISPLAY_PAST_EVENTS = "display_past_events"
|
||||
const val DISPLAY_DESCRIPTION = "display_description"
|
||||
const val REPLACE_DESCRIPTION = "replace_description"
|
||||
const val SHOW_GRID = "show_grid"
|
||||
const val LOOP_REMINDERS = "loop_reminders"
|
||||
|
|
|
@ -765,6 +765,22 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_display_description_holder"
|
||||
style="@style/SettingsHolderCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/ripple_background">
|
||||
|
||||
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
|
||||
android:id="@+id/settings_display_description"
|
||||
style="@style/SettingsCheckboxStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/display_description_or_location" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_replace_description_holder"
|
||||
style="@style/SettingsHolderCheckboxStyle"
|
||||
|
|
Loading…
Reference in a new issue