Fix #217
This commit is contained in:
@ -30,6 +30,7 @@ import kotlinx.android.synthetic.main.activity_choose_application.search
|
||||
import kotlinx.android.synthetic.main.activity_music_players_filter.*
|
||||
import kotlinx.coroutines.*
|
||||
import net.idik.lib.slimadapter.SlimAdapter
|
||||
import net.idik.lib.slimadapter.SlimAdapterEx
|
||||
|
||||
|
||||
class ChooseApplicationActivity : AppCompatActivity() {
|
||||
@ -47,7 +48,7 @@ class ChooseApplicationActivity : AppCompatActivity() {
|
||||
val mLayoutManager = LinearLayoutManager(this)
|
||||
list_view.layoutManager = mLayoutManager
|
||||
|
||||
adapter = SlimAdapter.create()
|
||||
adapter = SlimAdapterEx.create()
|
||||
adapter
|
||||
.register<String>(R.layout.application_info_layout) { _, injector ->
|
||||
injector
|
||||
|
@ -241,8 +241,6 @@ class GlanceTabFragment : Fragment() {
|
||||
val toPos = target.adapterPosition
|
||||
// move item in `fromPos` to `toPos` in adapter.
|
||||
adapter.notifyItemMoved(fromPos, toPos)
|
||||
|
||||
Collections.swap(list, fromPos, toPos)
|
||||
return true
|
||||
}
|
||||
|
||||
@ -250,12 +248,22 @@ class GlanceTabFragment : Fragment() {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun clearView(
|
||||
override fun onMoved(
|
||||
recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder
|
||||
viewHolder: RecyclerView.ViewHolder,
|
||||
fromPos: Int,
|
||||
target: RecyclerView.ViewHolder,
|
||||
toPos: Int,
|
||||
x: Int,
|
||||
y: Int
|
||||
) {
|
||||
super.clearView(recyclerView, viewHolder)
|
||||
with(list[fromPos]) {
|
||||
list[fromPos] = list[toPos]
|
||||
list[toPos] = this
|
||||
}
|
||||
GlanceProviderHelper.saveGlanceProviderOrder(list)
|
||||
Log.d("ciao", list.toString())
|
||||
super.onMoved(recyclerView, viewHolder, fromPos, target, toPos, x, y)
|
||||
}
|
||||
|
||||
override fun onChildDraw(
|
||||
@ -279,7 +287,6 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
|
||||
val topEdge = if ((view.top == 0 && dY < 0) || ((view.top + view.height >= recyclerView.height - 32f.convertDpToPixel(requireContext())) && dY > 0)) 0f else dY
|
||||
Log.d("ciao", "${view.top} + ${view.height} = ${view.top + view.height} to compare to ${recyclerView.height} - ${32f.convertDpToPixel(requireContext())}")
|
||||
|
||||
super.onChildDraw(c,
|
||||
recyclerView,
|
||||
@ -302,7 +309,6 @@ class GlanceTabFragment : Fragment() {
|
||||
adapter.updateData(
|
||||
GlanceProviderHelper.getGlanceProviders(requireContext())
|
||||
.mapNotNull { GlanceProviderHelper.getGlanceProviderById(requireContext(), it) }
|
||||
.filterNot { it.id == Constants.GlanceProviderId.GREETINGS.id }
|
||||
)
|
||||
providers_list.isNestedScrollingEnabled = false
|
||||
|
||||
|
@ -624,8 +624,15 @@ class MainWidget : AppWidgetProvider() {
|
||||
} else {
|
||||
val flags: Int =
|
||||
DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_NO_YEAR or DateUtils.FORMAT_ABBREV_MONTH
|
||||
v.next_event_date.text =
|
||||
val start = Calendar.getInstance().apply { timeInMillis = nextEvent.startDate }
|
||||
|
||||
v.next_event_date.text = if (now.get(Calendar.DAY_OF_YEAR) == start.get(Calendar.DAY_OF_YEAR)) {
|
||||
DateUtils.formatDateTime(context, nextEvent.startDate, flags)
|
||||
} else if (now.get(Calendar.DAY_OF_YEAR) > start.get(Calendar.DAY_OF_YEAR) || now.get(Calendar.YEAR) > start.get(Calendar.YEAR)) {
|
||||
DateUtils.formatDateTime(context, now.timeInMillis, flags)
|
||||
} else {
|
||||
DateUtils.formatDateTime(context, nextEvent.startDate, flags)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -718,9 +725,14 @@ class MainWidget : AppWidgetProvider() {
|
||||
if (Preferences.showNotifications && ActiveNotificationsHelper.showLastNotification()) {
|
||||
try {
|
||||
val remotePackageContext = context.createPackageContext(Preferences.lastNotificationPackage, 0)
|
||||
val icon = ContextCompat.getDrawable(remotePackageContext, Preferences.lastNotificationIcon)
|
||||
v.second_row_icon.isVisible = true
|
||||
v.second_row_icon.setImageDrawable(icon)
|
||||
if (Preferences.lastNotificationIcon != 0) {
|
||||
val icon = ContextCompat.getDrawable(remotePackageContext,
|
||||
Preferences.lastNotificationIcon)
|
||||
v.second_row_icon.isVisible = true
|
||||
v.second_row_icon.setImageDrawable(icon)
|
||||
} else {
|
||||
v.second_row_icon.isVisible = false
|
||||
}
|
||||
v.next_event_date.text = Preferences.lastNotificationTitle
|
||||
showSomething = true
|
||||
break@loop
|
||||
|
Reference in New Issue
Block a user