mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
minor code style update
This commit is contained in:
@ -1,7 +1,6 @@
|
|||||||
package com.simplemobiletools.calendar.adapters
|
package com.simplemobiletools.calendar.adapters
|
||||||
|
|
||||||
import android.graphics.PorterDuff
|
import android.graphics.PorterDuff
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
@ -35,7 +34,7 @@ class DayEventsAdapter(activity: SimpleActivity, val events: List<Event>, val li
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.event_item_day_view, parent, false)
|
val view = activity.layoutInflater.inflate(R.layout.event_item_day_view, parent, false)
|
||||||
return createViewHolder(view)
|
return createViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.simplemobiletools.calendar.adapters
|
package com.simplemobiletools.calendar.adapters
|
||||||
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
@ -30,7 +29,7 @@ class EventTypeAdapter(activity: SimpleActivity, val eventTypes: List<EventType>
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): MyAdapter.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): MyAdapter.ViewHolder {
|
||||||
val view = LayoutInflater.from(parent?.context).inflate(R.layout.item_event_type, parent, false)
|
val view = activity.layoutInflater.inflate(R.layout.item_event_type, parent, false)
|
||||||
return createViewHolder(view)
|
return createViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
addDisplayEventTypes(HashSet<String>(Arrays.asList(type)))
|
addDisplayEventTypes(HashSet<String>(Arrays.asList(type)))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addDisplayEventTypes(types: Set<String>) {
|
private fun addDisplayEventTypes(types: Set<String>) {
|
||||||
val currDisplayEventTypes = HashSet<String>(displayEventTypes)
|
val currDisplayEventTypes = HashSet<String>(displayEventTypes)
|
||||||
currDisplayEventTypes.addAll(types)
|
currDisplayEventTypes.addAll(types)
|
||||||
displayEventTypes = currDisplayEventTypes
|
displayEventTypes = currDisplayEventTypes
|
||||||
@ -112,11 +112,11 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
displayEventTypes = currDisplayEventTypes
|
displayEventTypes = currDisplayEventTypes
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getDefaultNotificationSound(): String {
|
private fun getDefaultNotificationSound(): String {
|
||||||
try {
|
return try {
|
||||||
return RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
|
RingtoneManager.getActualDefaultRingtoneUri(context, RingtoneManager.TYPE_NOTIFICATION)?.toString() ?: ""
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
return ""
|
""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
else -> getLargeFontSize()
|
else -> getLargeFontSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSmallFontSize() = getMediumFontSize() - 3f
|
private fun getSmallFontSize() = getMediumFontSize() - 3f
|
||||||
fun getMediumFontSize() = context.resources.getDimension(R.dimen.day_text_size) / context.resources.displayMetrics.density
|
private fun getMediumFontSize() = context.resources.getDimension(R.dimen.day_text_size) / context.resources.displayMetrics.density
|
||||||
fun getLargeFontSize() = getMediumFontSize() + 3f
|
private fun getLargeFontSize() = getMediumFontSize() + 3f
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user