diff --git a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt index 8ad35fe0..b4719411 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt @@ -21,6 +21,7 @@ import android.os.Bundle import android.util.Log import android.view.Gravity import android.view.View +import android.widget.ArrayAdapter import android.widget.FrameLayout import android.widget.LinearLayout import android.widget.ProgressBar @@ -42,12 +43,12 @@ import com.google.android.material.snackbar.Snackbar import com.google.android.material.transition.MaterialArcMotion import com.google.android.material.transition.MaterialContainerTransform import com.keylesspalace.tusky.adapter.ItemInteractionListener -import com.keylesspalace.tusky.adapter.ListSelectionAdapter import com.keylesspalace.tusky.adapter.TabAdapter import com.keylesspalace.tusky.appstore.EventHub import com.keylesspalace.tusky.appstore.MainTabsChangedEvent import com.keylesspalace.tusky.databinding.ActivityTabPreferenceBinding import com.keylesspalace.tusky.di.Injectable +import com.keylesspalace.tusky.entity.MastoList import com.keylesspalace.tusky.network.MastodonApi import com.keylesspalace.tusky.util.getDimension import com.keylesspalace.tusky.util.hide @@ -272,7 +273,7 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene } private fun showSelectListDialog() { - val adapter = ListSelectionAdapter(this) + val adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1) val statusLayout = LinearLayout(this) statusLayout.gravity = Gravity.CENTER @@ -298,12 +299,13 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene .setNegativeButton(android.R.string.cancel, null) .setView(statusLayout) .setAdapter(adapter) { _, position -> - val list = adapter.getItem(position) - val newTab = createTabDataFromId(LIST, listOf(list!!.id, list.title)) - currentTabs.add(newTab) - currentTabsAdapter.notifyItemInserted(currentTabs.size - 1) - updateAvailableTabs() - saveTabs() + adapter.getItem(position)?.let { item -> + val newTab = createTabDataFromId(LIST, listOf(item.id, item.title)) + currentTabs.add(newTab) + currentTabsAdapter.notifyItemInserted(currentTabs.size - 1) + updateAvailableTabs() + saveTabs() + } } val showProgressBarJob = getProgressBarJob(progress, 500) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/ListSelectionAdapter.kt b/app/src/main/java/com/keylesspalace/tusky/adapter/ListSelectionAdapter.kt deleted file mode 100644 index 7c2a1693..00000000 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/ListSelectionAdapter.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2019 kyori19 - * - * 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 . */ - -package com.keylesspalace.tusky.adapter - -import android.content.Context -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.ArrayAdapter -import com.keylesspalace.tusky.R -import com.keylesspalace.tusky.databinding.ItemPickerListBinding -import com.keylesspalace.tusky.entity.MastoList - -class ListSelectionAdapter(context: Context) : ArrayAdapter(context, R.layout.item_picker_list) { - override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { - val binding = if (convertView == null) { - ItemPickerListBinding.inflate(LayoutInflater.from(context), parent, false) - } else { - ItemPickerListBinding.bind(convertView) - } - - getItem(position)?.let { list -> - binding.root.text = list.title - } - - return binding.root - } -} diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchAccountsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchAccountsFragment.kt index 87be6980..1bcfaaaa 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchAccountsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchAccountsFragment.kt @@ -15,15 +15,28 @@ package com.keylesspalace.tusky.components.search.fragments +import android.os.Bundle +import android.view.View import androidx.paging.PagingData import androidx.paging.PagingDataAdapter import androidx.preference.PreferenceManager +import androidx.recyclerview.widget.DividerItemDecoration import com.keylesspalace.tusky.components.search.adapter.SearchAccountsAdapter import com.keylesspalace.tusky.entity.TimelineAccount import com.keylesspalace.tusky.settings.PrefKeys import kotlinx.coroutines.flow.Flow class SearchAccountsFragment : SearchFragment() { + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + binding.searchRecyclerView.addItemDecoration( + DividerItemDecoration( + binding.searchRecyclerView.context, + DividerItemDecoration.VERTICAL + ) + ) + } + override fun createAdapter(): PagingDataAdapter { val preferences = PreferenceManager.getDefaultSharedPreferences(binding.searchRecyclerView.context) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt index 86b54238..28790c2f 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchFragment.kt @@ -13,7 +13,6 @@ import androidx.lifecycle.lifecycleScope import androidx.paging.LoadState import androidx.paging.PagingData import androidx.paging.PagingDataAdapter -import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.SimpleItemAnimator import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -129,7 +128,6 @@ abstract class SearchFragment : } private fun initAdapter() { - binding.searchRecyclerView.addItemDecoration(DividerItemDecoration(binding.searchRecyclerView.context, DividerItemDecoration.VERTICAL)) binding.searchRecyclerView.layoutManager = LinearLayoutManager(binding.searchRecyclerView.context) adapter = createAdapter() binding.searchRecyclerView.adapter = adapter diff --git a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchHashtagsFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchHashtagsFragment.kt index d0b7e8fa..8c4f41fb 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchHashtagsFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/search/fragments/SearchHashtagsFragment.kt @@ -15,8 +15,11 @@ package com.keylesspalace.tusky.components.search.fragments +import android.os.Bundle +import android.view.View import androidx.paging.PagingData import androidx.paging.PagingDataAdapter +import androidx.recyclerview.widget.DividerItemDecoration import com.keylesspalace.tusky.components.search.adapter.SearchHashtagsAdapter import com.keylesspalace.tusky.entity.HashTag import kotlinx.coroutines.flow.Flow @@ -26,6 +29,16 @@ class SearchHashtagsFragment : SearchFragment() { override val data: Flow> get() = viewModel.hashtagsFlow + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + binding.searchRecyclerView.addItemDecoration( + DividerItemDecoration( + binding.searchRecyclerView.context, + DividerItemDecoration.VERTICAL + ) + ) + } + override fun createAdapter(): PagingDataAdapter = SearchHashtagsAdapter(this) companion object { diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index 021a1e8b..9b6d4f81 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -443,8 +443,7 @@ android:layout_height="wrap_content" android:background="?attr/colorSurface" app:tabGravity="center" - app:tabMode="scrollable" - app:tabTextAppearance="@style/TuskyTabAppearance" /> + app:tabMode="scrollable" /> diff --git a/app/src/main/res/layout/activity_followed_tags.xml b/app/src/main/res/layout/activity_followed_tags.xml index 412b4310..27b8a38d 100644 --- a/app/src/main/res/layout/activity_followed_tags.xml +++ b/app/src/main/res/layout/activity_followed_tags.xml @@ -25,6 +25,7 @@ android:layout_height="wrap_content" android:layout_gravity="center" app:layout_behavior="@string/appbar_scrolling_view_behavior" + tools:visibility="gone" /> + app:tabMode="fixed" /> diff --git a/app/src/main/res/layout/item_followed_hashtag.xml b/app/src/main/res/layout/item_followed_hashtag.xml index 4866679b..6419af54 100644 --- a/app/src/main/res/layout/item_followed_hashtag.xml +++ b/app/src/main/res/layout/item_followed_hashtag.xml @@ -1,41 +1,36 @@ - + + - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/item_hashtag.xml b/app/src/main/res/layout/item_hashtag.xml index efdb24f7..8266eaf6 100644 --- a/app/src/main/res/layout/item_hashtag.xml +++ b/app/src/main/res/layout/item_hashtag.xml @@ -1,7 +1,17 @@ + + + + tools:ignore="SelectableText" /> diff --git a/app/src/main/res/layout/item_list.xml b/app/src/main/res/layout/item_list.xml index 42be426d..e1d5f7fc 100644 --- a/app/src/main/res/layout/item_list.xml +++ b/app/src/main/res/layout/item_list.xml @@ -4,30 +4,29 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" - android:orientation="horizontal"> + android:orientation="horizontal" + android:minHeight="?android:attr/listPreferredItemHeightSmall" + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" + android:background="?attr/selectableItemBackground" + tools:ignore="Overdraw"> diff --git a/app/src/main/res/layout/item_picker_list.xml b/app/src/main/res/layout/item_picker_list.xml deleted file mode 100644 index d49c9303..00000000 --- a/app/src/main/res/layout/item_picker_list.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/app/src/main/res/layout/item_tab_preference.xml b/app/src/main/res/layout/item_tab_preference.xml index 9eb164c3..81e1f2b7 100644 --- a/app/src/main/res/layout/item_tab_preference.xml +++ b/app/src/main/res/layout/item_tab_preference.xml @@ -6,9 +6,10 @@ android:layout_height="wrap_content" android:background="?android:colorBackground" android:orientation="horizontal" - android:paddingStart="16dp" android:paddingTop="8dp" - android:paddingEnd="16dp"> + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" + android:minHeight="?android:attr/listPreferredItemHeightSmall"> + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintBottom_toBottomOf="@id/textView"/> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 3072a739..bcf041b0 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -106,7 +106,7 @@