diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index fdefe69b1..c199e72ca 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -29,7 +29,6 @@ import org.schabi.newpipe.database.subscription.SubscriptionEntity import org.schabi.newpipe.local.subscription.FeedGroupIcon import org.schabi.newpipe.local.subscription.dialog.FeedGroupDialogViewModel.FeedDialogEvent import org.schabi.newpipe.local.subscription.item.EmptyPlaceholderItem -import org.schabi.newpipe.local.subscription.item.HeaderTextSideItem import org.schabi.newpipe.local.subscription.item.PickerIconItem import org.schabi.newpipe.local.subscription.item.PickerSubscriptionItem import org.schabi.newpipe.util.AnimationUtils.animateView @@ -82,7 +81,7 @@ class FeedGroupDialog : DialogFragment() { super.onSaveInstanceState(outState) iconsListState = icon_selector.layoutManager?.onSaveInstanceState() - subscriptionsListState = subscriptions_selector.layoutManager?.onSaveInstanceState() + subscriptionsListState = subscriptions_selector_list.layoutManager?.onSaveInstanceState() Icepick.saveInstanceState(this, outState) } @@ -185,9 +184,7 @@ class FeedGroupDialog : DialogFragment() { val selectedCountText = getString(R.string.feed_group_dialog_selection_count, this.selectedSubscriptions.size) selected_subscription_count_view.text = selectedCountText - - val headerInfoItem = HeaderTextSideItem(getString(R.string.tab_subscriptions), selectedCountText) - groupAdapter.add(headerInfoItem) + subscriptions_selector_header_info.text = selectedCountText Section().apply { addAll(subscriptions.map { @@ -199,16 +196,11 @@ class FeedGroupDialog : DialogFragment() { groupAdapter.add(this) } - subscriptions_selector.apply { - if (useGridLayout) { - layoutManager = GridLayoutManager(requireContext(), groupAdapter.spanCount, RecyclerView.VERTICAL, false).apply { - spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() { - override fun getSpanSize(position: Int) = - if (position == 0) 4 else 1 - } - } + subscriptions_selector_list.apply { + layoutManager = if (useGridLayout) { + GridLayoutManager(requireContext(), groupAdapter.spanCount, RecyclerView.VERTICAL, false) } else { - layoutManager = LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false) + LinearLayoutManager(requireContext(), RecyclerView.VERTICAL, false) } adapter = groupAdapter @@ -237,14 +229,13 @@ class FeedGroupDialog : DialogFragment() { val updateSelectedCountText = getString(R.string.feed_group_dialog_selection_count, this.selectedSubscriptions.size) selected_subscription_count_view.text = updateSelectedCountText - headerInfoItem.infoText = updateSelectedCountText - headerInfoItem.notifyChanged(HeaderTextSideItem.UPDATE_INFO) + subscriptions_selector_header_info.text = updateSelectedCountText } } } select_channel_button.setOnClickListener { - subscriptions_selector.scrollToPosition(0) + subscriptions_selector_list.scrollToPosition(0) showSubscriptionsPicker() } } diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/item/HeaderTextSideItem.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/item/HeaderTextSideItem.kt deleted file mode 100644 index 5ec060ded..000000000 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/item/HeaderTextSideItem.kt +++ /dev/null @@ -1,37 +0,0 @@ -package org.schabi.newpipe.local.subscription.item - -import android.view.View.OnClickListener -import com.xwray.groupie.kotlinandroidextensions.Item -import com.xwray.groupie.kotlinandroidextensions.GroupieViewHolder -import kotlinx.android.synthetic.main.header_with_text_item.* -import org.schabi.newpipe.R - -class HeaderTextSideItem( - val title: String, - var infoText: String? = null, - private val onClickListener: (() -> Unit)? = null -) : Item() { - - companion object { - const val UPDATE_INFO = 123 - } - - override fun getLayout(): Int = R.layout.header_with_text_item - - override fun bind(viewHolder: GroupieViewHolder, position: Int, payloads: MutableList) { - if (payloads.contains(UPDATE_INFO)) { - viewHolder.header_info.text = infoText - return - } - - super.bind(viewHolder, position, payloads) - } - - override fun bind(viewHolder: GroupieViewHolder, position: Int) { - viewHolder.header_title.text = title - viewHolder.header_info.text = infoText - - val listener: OnClickListener? = if (onClickListener != null) OnClickListener { onClickListener.invoke() } else null - viewHolder.root.setOnClickListener(listener) - } -} \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_feed_group_create.xml b/app/src/main/res/layout/dialog_feed_group_create.xml index df96fb09f..576b01e6a 100644 --- a/app/src/main/res/layout/dialog_feed_group_create.xml +++ b/app/src/main/res/layout/dialog_feed_group_create.xml @@ -15,8 +15,7 @@ android:minHeight="150dp" android:orientation="vertical" android:padding="8dp" - android:visibility="gone" - tools:visibility="visible"> + android:visibility="gone"> - + tools:visibility="visible"> + + + + + + + + + + Loading feed… Processing feed… Select subscriptions - %d selected + Selected: %d No subscription selected Empty group name Name