diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/FilterSheetBottomFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/FilterSheetBottomFragment.kt deleted file mode 100644 index 7621caf23948..000000000000 --- a/AnkiDroid/src/main/java/com/ichi2/anki/FilterSheetBottomFragment.kt +++ /dev/null @@ -1,300 +0,0 @@ -/**************************************************************************************** - * Copyright (c) 2022 Akshit Sinha * - * * - * 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. * - * * - * This program 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 * - * this program. If not, see . * - ****************************************************************************************/ - -package com.ichi2.anki - -import android.content.Context -import android.os.Bundle -import android.os.SystemClock -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.* -import androidx.annotation.DrawableRes -import androidx.annotation.StringRes -import androidx.core.view.isVisible -import androidx.recyclerview.widget.DividerItemDecoration -import androidx.recyclerview.widget.LinearLayoutManager -import androidx.recyclerview.widget.RecyclerView -import anki.search.SearchNode -import anki.search.SearchNodeKt.group -import anki.search.searchNode -import com.google.android.material.bottomsheet.BottomSheetBehavior -import com.google.android.material.bottomsheet.BottomSheetDialogFragment -import com.ichi2.anki.CollectionManager.withCol -import com.ichi2.annotations.NeedsTest -import com.ichi2.themes.Themes.getColorFromAttr - -/** - * This class handles the Filter Bottom Sheet present in the Card Browser - * This class is used to apply filters for search queries - */ -class FilterSheetBottomFragment : - BottomSheetDialogFragment() { - private lateinit var behavior: BottomSheetBehavior - - private var flagSearchItems = mutableSetOf() - - private lateinit var flagRecyclerView: RecyclerView - private lateinit var flagListAdapter: FlagsAdapter - - private lateinit var flagToggleIcon: ImageView - - /** Heading of the Flags filter section */ - private lateinit var filterHeaderFlags: TextView - - /** Icon of the Flags filter section */ - private lateinit var filterIconFlags: ImageView - - private var lastClickTime = 0 - - // flagName is displayed in filter sheet as the name of the filter - enum class Flags(@StringRes private val flagNameRes: Int, val flagNode: SearchNode.Flag, @DrawableRes val flagToggleIcon: Int) { - NO_FLAG(R.string.menu_flag_card_zero, SearchNode.Flag.FLAG_NONE, R.drawable.label_icon_flags), - RED(R.string.menu_flag_card_one, SearchNode.Flag.FLAG_RED, R.drawable.ic_flag_red), - ORANGE(R.string.menu_flag_card_two, SearchNode.Flag.FLAG_ORANGE, R.drawable.ic_flag_orange), - GREEN(R.string.menu_flag_card_three, SearchNode.Flag.FLAG_GREEN, R.drawable.ic_flag_green), - BLUE(R.string.menu_flag_card_four, SearchNode.Flag.FLAG_BLUE, R.drawable.ic_flag_blue), - PINK(R.string.menu_flag_card_five, SearchNode.Flag.FLAG_PINK, R.drawable.ic_flag_pink), - TURQUOISE(R.string.menu_flag_card_six, SearchNode.Flag.FLAG_TURQUOISE, R.drawable.ic_flag_turquoise), - PURPLE(R.string.menu_flag_card_seven, SearchNode.Flag.FLAG_PURPLE, R.drawable.ic_flag_purple); - - fun getFlagName(context: Context): String = context.getString(flagNameRes) - } - - override fun onCreateView( - inflater: LayoutInflater, - container: ViewGroup?, - savedInstanceState: Bundle? - ): View = inflater.inflate(R.layout.filter_bottom_sheet, container, false).apply { - // Create a query with currently selected filters, and close the filter sheet - val applyButton = this.findViewById