2021-06-17 18:54:56 +02:00
|
|
|
/* Copyright 2021 Tusky Contributors
|
2019-07-19 20:10:20 +02:00
|
|
|
*
|
|
|
|
* This file is a part of Tusky.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
|
|
* Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along with Tusky; if not,
|
|
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
|
|
|
|
package com.keylesspalace.tusky.components.search.fragments
|
|
|
|
|
Adjust list UX for platform consistency (#3142)
Most lists in the app use (explicitly or implicitly) platform metrics for dimensions, text size, colour, and so on, possibly via styles.
A few don't, inadvertently using the user's setting for status text size
Fix these, and simplify code where possible.
- Use android attributes for padding and height, for consistent UX.
- Remove explicit usage of app:tabTextAppearance, rely on the style.
- Remove ListSelectionAdapter and item_picker_list.xml, and adjust TabPreferenceActivity to use an ArrayAdapter with simple_list_item_1.xml
- Simplify item_followed_hashtag.xml, consistent with item_list.xml.
Fixes https://github.com/tuskyapp/Tusky/issues/3131
2023-06-29 18:36:19 +02:00
|
|
|
import android.os.Bundle
|
|
|
|
import android.view.View
|
2021-06-17 18:54:56 +02:00
|
|
|
import androidx.paging.PagingData
|
|
|
|
import androidx.paging.PagingDataAdapter
|
2021-02-06 08:14:51 +01:00
|
|
|
import androidx.preference.PreferenceManager
|
Adjust list UX for platform consistency (#3142)
Most lists in the app use (explicitly or implicitly) platform metrics for dimensions, text size, colour, and so on, possibly via styles.
A few don't, inadvertently using the user's setting for status text size
Fix these, and simplify code where possible.
- Use android attributes for padding and height, for consistent UX.
- Remove explicit usage of app:tabTextAppearance, rely on the style.
- Remove ListSelectionAdapter and item_picker_list.xml, and adjust TabPreferenceActivity to use an ArrayAdapter with simple_list_item_1.xml
- Simplify item_followed_hashtag.xml, consistent with item_list.xml.
Fixes https://github.com/tuskyapp/Tusky/issues/3131
2023-06-29 18:36:19 +02:00
|
|
|
import androidx.recyclerview.widget.DividerItemDecoration
|
2019-07-19 20:10:20 +02:00
|
|
|
import com.keylesspalace.tusky.components.search.adapter.SearchAccountsAdapter
|
2022-03-15 21:34:57 +01:00
|
|
|
import com.keylesspalace.tusky.entity.TimelineAccount
|
2021-02-06 08:14:51 +01:00
|
|
|
import com.keylesspalace.tusky.settings.PrefKeys
|
2021-06-17 18:54:56 +02:00
|
|
|
import kotlinx.coroutines.flow.Flow
|
2019-07-19 20:10:20 +02:00
|
|
|
|
2022-03-15 21:34:57 +01:00
|
|
|
class SearchAccountsFragment : SearchFragment<TimelineAccount>() {
|
Adjust list UX for platform consistency (#3142)
Most lists in the app use (explicitly or implicitly) platform metrics for dimensions, text size, colour, and so on, possibly via styles.
A few don't, inadvertently using the user's setting for status text size
Fix these, and simplify code where possible.
- Use android attributes for padding and height, for consistent UX.
- Remove explicit usage of app:tabTextAppearance, rely on the style.
- Remove ListSelectionAdapter and item_picker_list.xml, and adjust TabPreferenceActivity to use an ArrayAdapter with simple_list_item_1.xml
- Simplify item_followed_hashtag.xml, consistent with item_list.xml.
Fixes https://github.com/tuskyapp/Tusky/issues/3131
2023-06-29 18:36:19 +02:00
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
|
|
super.onViewCreated(view, savedInstanceState)
|
|
|
|
binding.searchRecyclerView.addItemDecoration(
|
|
|
|
DividerItemDecoration(
|
|
|
|
binding.searchRecyclerView.context,
|
|
|
|
DividerItemDecoration.VERTICAL
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-03-15 21:34:57 +01:00
|
|
|
override fun createAdapter(): PagingDataAdapter<TimelineAccount, *> {
|
2021-03-13 21:27:20 +01:00
|
|
|
val preferences = PreferenceManager.getDefaultSharedPreferences(binding.searchRecyclerView.context)
|
2021-02-06 08:14:51 +01:00
|
|
|
|
|
|
|
return SearchAccountsAdapter(
|
2021-06-28 21:13:24 +02:00
|
|
|
this,
|
|
|
|
preferences.getBoolean(PrefKeys.ANIMATE_GIF_AVATARS, false),
|
2022-12-28 19:07:43 +01:00
|
|
|
preferences.getBoolean(PrefKeys.ANIMATE_CUSTOM_EMOJIS, false),
|
|
|
|
preferences.getBoolean(PrefKeys.SHOW_BOT_OVERLAY, true)
|
2021-02-06 08:14:51 +01:00
|
|
|
)
|
|
|
|
}
|
2019-07-19 20:10:20 +02:00
|
|
|
|
2022-03-15 21:34:57 +01:00
|
|
|
override val data: Flow<PagingData<TimelineAccount>>
|
2021-06-17 18:54:56 +02:00
|
|
|
get() = viewModel.accountsFlow
|
2019-07-19 20:10:20 +02:00
|
|
|
|
|
|
|
companion object {
|
|
|
|
fun newInstance() = SearchAccountsFragment()
|
|
|
|
}
|
|
|
|
}
|