package com.seatel.mobilehall.ui.packages.adapter

import android.content.Context
import android.os.Handler
import android.text.TextUtils
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.seatel.mobilehall.R
import com.seatel.mobilehall.databinding.ItemInternationalCallDetailActivityBinding
import com.seatel.mobilehall.ui.base.adapter.BaseAdapter
import com.seatel.mobilehall.ui.home.adapter.InternationalCallAdapter
import com.seatel.mobilehall.ui.home.model.CountryModel
import com.seatel.mobilehall.ui.home.model.ValuePackSectionModel
import com.seatel.mobilehall.ui.packages.model.TableModel
import com.seatel.mobilehall.ui.packages.model.TableSubModel
import com.seatel.mobilehall.util.SeatelUtils
import com.seatel.mobilehall.util.lang.LanguageManager


class InternationalAdapter(
    private var context: Context, private var valuePackSectionModel: ValuePackSectionModel
) : BaseAdapter<InternationalAdapter.ViewHolder>() {


    private lateinit var mAdapter: InternationalCallAdapter
    var lang: String = "en"
    var tableDataList = ArrayList<TableModel>()
    var tableDataListDisplay = ArrayList<TableModel>()

    class ViewHolder(var binding: ItemInternationalCallDetailActivityBinding) :
        RecyclerView.ViewHolder(binding.root)

    override fun onCreateViewHolder(
        parent: ViewGroup, viewType: Int
    ): ViewHolder {
        val binding = ItemInternationalCallDetailActivityBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        )

        return ViewHolder(binding)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {

        holder.itemView.run {
            Glide.with(this).load(valuePackSectionModel.dataPackDetailSecOneModel.mobileImageUrl)
                .fitCenter().into(holder.binding.imgInternationalCallDetail)
            holder.binding.textCentsMin.text = context.getText(R.string.cents)
            mAdapter = InternationalCallAdapter(
                context, tableDataListDisplay
            )
            mAdapter.onFilterFinish = InternationalCallAdapter.OnFilter { _, content ->
                val viewHolder =
                    holder.binding.recyclerViewProductService.findViewHolderForAdapterPosition(0)
                if (viewHolder != null) {
                    val subAdapter =
                        (viewHolder as InternationalCallAdapter.DetailViewHolder).mAdapter
                    subAdapter.filter.filter(content)
                }

            }
            holder.binding.recyclerViewProductService.layoutManager =
                object : LinearLayoutManager(context) {
                    override fun canScrollVertically(): Boolean {
                        return false
                    }
                }
            holder.binding.recyclerViewProductService.setHasFixedSize(true)
            holder.binding.recyclerViewProductService.adapter = mAdapter

            if (LanguageManager.getInstance(context).getLanguageCode() != null) lang =
                LanguageManager.getInstance(context).getLanguageCode()!!.toLowerCase()

            Handler().postDelayed({
                getTableData(context, holder)
            }, 200)
        }


    }


    override fun getItemCount(): Int {
        return 1
    }


    fun filter(charString: String) {
        val tableModel = TableModel(charString, ArrayList())
        val index = tableDataList.indexOf(tableModel)
        if (index != -1) {
            val tmptableModel = tableDataList[index]
            val tableSubModel = TableSubModel(charString, "")

            val indexSub: Int = tmptableModel.destination!!.indexOf(tableSubModel)
            if (indexSub != -1) {
                val tmpSubTable = tmptableModel.destination!![indexSub]
                val subList = ArrayList<TableSubModel>()
                subList.add(tmpSubTable)
                val newTableModel = TableModel(tmptableModel.standard, subList)

                tableDataListDisplay.clear()
                tableDataListDisplay.add(newTableModel)
                mAdapter.notifyDataSetChanged()
                Handler().postDelayed({
                    tableDataListDisplay.clear()
                }, 200)

            }
        }


    }

    private fun getTableData(context: Context, holder: ViewHolder) {
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        val strCent = holder.binding.textCentsMin.text
        val tableDataSubList = ArrayList<TableSubModel>()
        val subData1 = TableSubModel(context.getString(R.string.china), "86")
        val subData2 = TableSubModel(context.getString(R.string.hong_kong_china), "852")
        val subData3 = TableSubModel(context.getString(R.string.malaysia), "60")
        val subData4 = TableSubModel(context.getString(R.string.singapore), "65")
        val subData5 = TableSubModel(context.getString(R.string.thailand), "66")
        tableDataSubList.add(subData1)
        tableDataSubList.add(subData2)
        tableDataSubList.add(subData3)
        tableDataSubList.add(subData4)
        tableDataSubList.add(subData5)
        val tableModel = TableModel("3 $strCent", tableDataSubList)

        //Data 7 Cents
        val tableDataSubList7cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        val strCent1 = holder.binding.textCentsMin.text
        val subData7cent1 = TableSubModel(context.getString(R.string.american_samoa), "1")
        val subData7cent2 = TableSubModel(context.getString(R.string.bangladesh), "880")
        val subData7cent3 = TableSubModel(context.getString(R.string.canada), "1")
        val subData7cent4 = TableSubModel(context.getString(R.string.denmark), "45")
        val subData7cent5 = TableSubModel(context.getString(R.string.guam), "1")
        val subData7cent6 = TableSubModel(context.getString(R.string.hungary), "36")
        val subData7cent7 = TableSubModel(context.getString(R.string.iceland), "354")
        val subData7cent8 = TableSubModel(context.getString(R.string.india), "91")
        val subData7cent9 = TableSubModel(context.getString(R.string.malta_Mobile), "356")
        val subData7cent10 = TableSubModel(context.getString(R.string.mariana_islands), "1")
        val subData7cent11 = TableSubModel(context.getString(R.string.puerto_rico), "1")
        val subData7cent12 = TableSubModel(context.getString(R.string.romania), "40")
        val subData7cent13 = TableSubModel(context.getString(R.string.south_korea), "82")
        val subData7cent14 = TableSubModel(context.getString(R.string.sweden), "46")

        tableDataSubList7cent.add(subData7cent1)
        tableDataSubList7cent.add(subData7cent2)
        tableDataSubList7cent.add(subData7cent3)
        tableDataSubList7cent.add(subData7cent4)
        tableDataSubList7cent.add(subData7cent5)
        tableDataSubList7cent.add(subData7cent6)
        tableDataSubList7cent.add(subData7cent7)
        tableDataSubList7cent.add(subData7cent8)
        tableDataSubList7cent.add(subData7cent9)
        tableDataSubList7cent.add(subData7cent10)
        tableDataSubList7cent.add(subData7cent11)
        tableDataSubList7cent.add(subData7cent12)
        tableDataSubList7cent.add(subData7cent13)
        tableDataSubList7cent.add(subData7cent14)
        val tableModel1 = TableModel("7 $strCent1", tableDataSubList7cent)

        //Data 10 Cents
        val tableDataSubList10cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        val strCent10 = holder.binding.textCentsMin.text
        val subData10cent1 = TableSubModel(context.getString(R.string.australia), "61")
        val subData10cent2 =
            TableSubModel(context.getString(R.string.australia_mobile_Satellite), "61")
        val subData10cent3 = TableSubModel(context.getString(R.string.bermuda), "1")
        val subData10cent4 = TableSubModel(context.getString(R.string.brunei), "673")
//        val subData10cent5 = TableSubModel(context.getString(R.string.cambodia), "855")
        val subData10cent6 =
            TableSubModel(context.getString(R.string.canada_Yukon_NW_Territories), "1")
        val subData10cent7 = TableSubModel(context.getString(R.string.costa_rica), "506")
        val subData10cent8 = TableSubModel(context.getString(R.string.czech_republic), "420")
        val subData10cent9 = TableSubModel(
            context.getString(R.string.france_mobile_globalstar_special_services), "33"
        )
        val subData10cent10 = TableSubModel(context.getString(R.string.french_guiana), "594")
        val subData10cent11 = TableSubModel(context.getString(R.string.greece), "30")
        val subData10cent12 = TableSubModel(context.getString(R.string.guadeloupe), "590")
        val subData10cent13 = TableSubModel(context.getString(R.string.indonesia), "62")
        val subData10cent14 = TableSubModel(context.getString(R.string.japan), "81")
        val subData10cent15 = TableSubModel(context.getString(R.string.kazakhstan_other_OLO), "7")
        val subData10cent16 = TableSubModel(context.getString(R.string.macau), "853")
        val subData10cent17 = TableSubModel(context.getString(R.string.martinique), "596")
        val subData10cent18 = TableSubModel(context.getString(R.string.mayotte), "262")
        val subData10cent19 = TableSubModel(context.getString(R.string.mexico), "52")
        val subData10cent20 = TableSubModel(context.getString(R.string.mongolia), "976")
        val subData10cent21 = TableSubModel(context.getString(R.string.namibia), "264")
        val subData10cent22 = TableSubModel(context.getString(R.string.new_zealand), "64")
        val subData10cent23 = TableSubModel(context.getString(R.string.nigeria_mobile), "234")
        val subData10cent24 = TableSubModel(context.getString(R.string.pakistan), "92")
        val subData10cent25 =
            TableSubModel(context.getString(R.string.reunion_island_mobile), "262")
        val subData10cent26 = TableSubModel(context.getString(R.string.russia_moscow_central), "7")
        val subData10cent27 = TableSubModel(context.getString(R.string.russia_other), "7")
        val subData10cent28 = TableSubModel(context.getString(R.string.russia_st_petersburg), "7")
        val subData10cent30 =
            TableSubModel(context.getString(R.string.universal_disaster_relief), "888")
        val subData10cent31 = TableSubModel(context.getString(R.string.usa_lata), "1")
        val subData10cent32 = TableSubModel(context.getString(R.string.usa_other_mainland), "1")
        val subData10cent33 = TableSubModel(context.getString(R.string.uzbekistan), "998")
        val subData10cent34 = TableSubModel(context.getString(R.string.vietnam), "84")

        tableDataSubList10cent.add(subData10cent1)
        tableDataSubList10cent.add(subData10cent2)
        tableDataSubList10cent.add(subData10cent3)
        tableDataSubList10cent.add(subData10cent4)
//        tableDataSubList10cent.add(subData10cent5)
        tableDataSubList10cent.add(subData10cent6)
        tableDataSubList10cent.add(subData10cent7)
        tableDataSubList10cent.add(subData10cent8)
        tableDataSubList10cent.add(subData10cent9)
        tableDataSubList10cent.add(subData10cent10)
        tableDataSubList10cent.add(subData10cent11)
        tableDataSubList10cent.add(subData10cent12)
        tableDataSubList10cent.add(subData10cent13)
        tableDataSubList10cent.add(subData10cent14)
        tableDataSubList10cent.add(subData10cent15)
        tableDataSubList10cent.add(subData10cent16)
        tableDataSubList10cent.add(subData10cent17)
        tableDataSubList10cent.add(subData10cent18)
        tableDataSubList10cent.add(subData10cent19)
        tableDataSubList10cent.add(subData10cent20)
        tableDataSubList10cent.add(subData10cent21)
        tableDataSubList10cent.add(subData10cent22)
        tableDataSubList10cent.add(subData10cent23)
        tableDataSubList10cent.add(subData10cent24)
        tableDataSubList10cent.add(subData10cent25)
        tableDataSubList10cent.add(subData10cent26)
        tableDataSubList10cent.add(subData10cent27)
        tableDataSubList10cent.add(subData10cent28)
        tableDataSubList10cent.add(subData10cent30)
        tableDataSubList10cent.add(subData10cent31)
        tableDataSubList10cent.add(subData10cent32)
        tableDataSubList10cent.add(subData10cent33)
        tableDataSubList10cent.add(subData10cent34)
        val tableModel2 = TableModel("10 $strCent10", tableDataSubList10cent)

        //Data 15 Cents
        val tableDataSubList15cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        val strCent15 = holder.binding.textCentsMin.text
        val subData15cent1 = TableSubModel(context.getString(R.string.angola), "224")
        val subData15cent2 = TableSubModel(context.getString(R.string.argentina), "54")
        val subData15cent3 = TableSubModel(context.getString(R.string.bahrain), "973")
        val subData15cent4 = TableSubModel(context.getString(R.string.bhutan), "975")
        val subData15cent5 = TableSubModel(context.getString(R.string.cyprus), "357")
        val subData15cent6 = TableSubModel(context.getString(R.string.dominican_republic), "1")
        val subData15cent7 = TableSubModel(context.getString(R.string.egypt), "20")
        val subData15cent8 = TableSubModel(context.getString(R.string.ireland), "353")
        val subData15cent9 = TableSubModel(context.getString(R.string.kuwait_mobile), "965")
        val subData15cent10 = TableSubModel(context.getString(R.string.laos), "856")
        val subData15cent11 =
            TableSubModel(context.getString(R.string.liechtenstein_special_services), "423")
        val subData15cent12 = TableSubModel(context.getString(R.string.luxembourg), "352")
        val subData15cent13 = TableSubModel(context.getString(R.string.nepal), "977")
        val subData15cent14 = TableSubModel(context.getString(R.string.paraguay), "595")
        val subData15cent15 =
            TableSubModel(context.getString(R.string.reunion_island_mobile), "262")
        val subData15cent16 = TableSubModel(context.getString(R.string.saudi_arabia), "966")
        val subData15cent17 = TableSubModel(context.getString(R.string.slovakia), "421")
        val subData15cent18 = TableSubModel(context.getString(R.string.st_maarten), "1721")
        val subData15cent19 = TableSubModel(context.getString(R.string.taiwan), "886")
        val subData15cent20 = TableSubModel(context.getString(R.string.venezuela), "58")

        tableDataSubList15cent.add(subData15cent1)
        tableDataSubList15cent.add(subData15cent2)
        tableDataSubList15cent.add(subData15cent3)
        tableDataSubList15cent.add(subData15cent4)
        tableDataSubList15cent.add(subData15cent5)
        tableDataSubList15cent.add(subData15cent6)
        tableDataSubList15cent.add(subData15cent7)
        tableDataSubList15cent.add(subData15cent8)
        tableDataSubList15cent.add(subData15cent9)
        tableDataSubList15cent.add(subData15cent10)
        tableDataSubList15cent.add(subData15cent11)
        tableDataSubList15cent.add(subData15cent12)
        tableDataSubList15cent.add(subData15cent13)
        tableDataSubList15cent.add(subData15cent14)
        tableDataSubList15cent.add(subData15cent15)
        tableDataSubList15cent.add(subData15cent16)
        tableDataSubList15cent.add(subData15cent17)
        tableDataSubList15cent.add(subData15cent18)
        tableDataSubList15cent.add(subData15cent19)
        tableDataSubList15cent.add(subData15cent20)
        val tableModel5 = TableModel("15 $strCent15", tableDataSubList15cent)
        //Data 25 Cents
        val tableDataSubList25cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        var strCent25 = holder.binding.textCentsMin.text
        val subData25cent1 = TableSubModel(context.getString(R.string.iran), "98")
        val subData25cent2 = TableSubModel(context.getString(R.string.jordan), "962")
        val subData25cent3 = TableSubModel(context.getString(R.string.norway), "47")
        val subData25cent4 = TableSubModel(context.getString(R.string.south_africa), "27")
        val subData25cent5 = TableSubModel(context.getString(R.string.abkhazia), "7")
        val subData25cent6 = TableSubModel(context.getString(R.string.afghanistan), "93")
        val subData25cent7 = TableSubModel(context.getString(R.string.andorra), "376")
        val subData25cent8 = TableSubModel(context.getString(R.string.aruba), "297")
        val subData25cent9 = TableSubModel(context.getString(R.string.bahamas), "1")
        val subData25cent10 = TableSubModel(context.getString(R.string.bolivia), "591")
        val subData25cent11 = TableSubModel(context.getString(R.string.cayman_islands), "1")
        val subData25cent12 = TableSubModel(context.getString(R.string.colombia), "57")
        val subData25cent13 = TableSubModel(context.getString(R.string.ecuador), "593")
        val subData25cent14 = TableSubModel(context.getString(R.string.el_salvador), "503")
        val subData25cent15 = TableSubModel(context.getString(R.string.faroe_islands), "298")
        val subData25cent16 = TableSubModel(context.getString(R.string.ghana), "233")
        val subData25cent17 = TableSubModel(context.getString(R.string.gibraltar), "350")
        val subData25cent18 = TableSubModel(context.getString(R.string.guatemala), "502")
        val subData25cent19 = TableSubModel(context.getString(R.string.honduras), "504")
        val subData25cent20 = TableSubModel(context.getString(R.string.iraq), "964")
        val subData25cent21 = TableSubModel(context.getString(R.string.israel), "972")
        val subData25cent22 = TableSubModel(context.getString(R.string.kyrgyzstan), "996")
        val subData25cent23 = TableSubModel(context.getString(R.string.lebanon), "961")
        val subData25cent24 = TableSubModel(context.getString(R.string.marshall_islands), "692")
        val subData25cent25 = TableSubModel(context.getString(R.string.netherlands_antilles), "599")
        val subData25cent26 = TableSubModel(context.getString(R.string.new_caledonia), "687")
        val subData25cent27 = TableSubModel(context.getString(R.string.palestine), "970")
        val subData25cent28 = TableSubModel(context.getString(R.string.panama), "507")
        val subData25cent29 = TableSubModel(context.getString(R.string.philippines), "63")
        val subData25cent30 = TableSubModel(context.getString(R.string.qatar), "974")
        val subData25cent31 = TableSubModel(context.getString(R.string.rusia_other1), "7")
        val subData25cent32 = TableSubModel(context.getString(R.string.spain), "34")
        val subData25cent33 = TableSubModel(context.getString(R.string.sri_lanka), "94")
        val subData25cent34 = TableSubModel(context.getString(R.string.sudan), "249")
        val subData25cent35 = TableSubModel(context.getString(R.string.swaziland), "268")
        val subData25cent36 = TableSubModel(context.getString(R.string.syria), "963")
        val subData25cent37 = TableSubModel(context.getString(R.string.tadjikistan), "992")
        val subData25cent38 = TableSubModel(context.getString(R.string.trinidad_tobago), "1")
        val subData25cent39 = TableSubModel(context.getString(R.string.turkey), "90")
        val subData25cent40 = TableSubModel(context.getString(R.string.turkmenistan), "993")
        val subData25cent41 =
            TableSubModel(context.getString(R.string.universal_disaster_relief), "888")
        val subData25cent42 = TableSubModel(context.getString(R.string.uruguay_mobile), "598")
        val subData25cent43 = TableSubModel(context.getString(R.string.yemen), "967")
        val subData25cent44 = TableSubModel(context.getString(R.string.zambia_mobile), "260")


        tableDataSubList25cent.add(subData25cent1)
        tableDataSubList25cent.add(subData25cent2)
        tableDataSubList25cent.add(subData25cent3)
        tableDataSubList25cent.add(subData25cent4)
        tableDataSubList25cent.add(subData25cent5)
        tableDataSubList25cent.add(subData25cent6)
        tableDataSubList25cent.add(subData25cent7)
        tableDataSubList25cent.add(subData25cent8)
        tableDataSubList25cent.add(subData25cent9)
        tableDataSubList25cent.add(subData25cent10)
        tableDataSubList25cent.add(subData25cent11)
        tableDataSubList25cent.add(subData25cent12)
        tableDataSubList25cent.add(subData25cent13)
        tableDataSubList25cent.add(subData25cent14)
        tableDataSubList25cent.add(subData25cent15)
        tableDataSubList25cent.add(subData25cent16)
        tableDataSubList25cent.add(subData25cent17)
        tableDataSubList25cent.add(subData25cent18)
        tableDataSubList25cent.add(subData25cent19)
        tableDataSubList25cent.add(subData25cent20)
        tableDataSubList25cent.add(subData25cent21)
        tableDataSubList25cent.add(subData25cent22)
        tableDataSubList25cent.add(subData25cent23)
        tableDataSubList25cent.add(subData25cent24)
        tableDataSubList25cent.add(subData25cent25)
        tableDataSubList25cent.add(subData25cent26)
        tableDataSubList25cent.add(subData25cent27)
        tableDataSubList25cent.add(subData25cent28)
        tableDataSubList25cent.add(subData25cent29)
        tableDataSubList25cent.add(subData25cent30)
        tableDataSubList25cent.add(subData25cent31)
        tableDataSubList25cent.add(subData25cent31)
        tableDataSubList25cent.add(subData25cent32)
        tableDataSubList25cent.add(subData25cent33)
        tableDataSubList25cent.add(subData25cent34)
        tableDataSubList25cent.add(subData25cent35)
        tableDataSubList25cent.add(subData25cent36)
        tableDataSubList25cent.add(subData25cent37)
        tableDataSubList25cent.add(subData25cent38)
        tableDataSubList25cent.add(subData25cent39)
        tableDataSubList25cent.add(subData25cent40)
        tableDataSubList25cent.add(subData25cent41)
        tableDataSubList25cent.add(subData25cent42)
        tableDataSubList25cent.add(subData25cent43)
        tableDataSubList25cent.add(subData25cent44)

        val tableMode25 = TableModel("25 $strCent25", tableDataSubList25cent)

        //Data 30 Cents
        val tableDataSubList30cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        var strCent30 = holder.binding.textCentsMin.text
        val subData30cent1 = TableSubModel(context.getString(R.string.antigua_barbuda), "1")
        val subData30cent2 = TableSubModel(context.getString(R.string.armenia), "374")
        val subData30cent3 = TableSubModel(context.getString(R.string.austria), "43")
        val subData30cent4 = TableSubModel(context.getString(R.string.austria), "43")
        val subData30cent5 = TableSubModel(context.getString(R.string.belize), "501")
        val subData30cent6 = TableSubModel(context.getString(R.string.botswana), "267")
        val subData30cent7 = TableSubModel(context.getString(R.string.brazil), "55")
        val subData30cent8 = TableSubModel(context.getString(R.string.british_virgin_islands), "1")
        val subData30cent9 = TableSubModel(context.getString(R.string.dominica), "1")
        val subData30cent10 = TableSubModel(context.getString(R.string.eritrea), "291")
        val subData30cent11 = TableSubModel(context.getString(R.string.ethiopia), "251")
        val subData30cent12 = TableSubModel(context.getString(R.string.georgia), "995")
        val subData30cent13 = TableSubModel(context.getString(R.string.germany), "49")
        val subData30cent14 = TableSubModel(context.getString(R.string.guyana), "592")
        val subData30cent15 = TableSubModel(context.getString(R.string.italy), "39")
        val subData30cent16 = TableSubModel(context.getString(R.string.jamaica), "1")
        val subData30cent17 = TableSubModel(context.getString(R.string.kenya), "254")
        val subData30cent18 = TableSubModel(context.getString(R.string.libya), "254")
        val subData30cent19 = TableSubModel(context.getString(R.string.montserrat), "1")
        val subData30cent20 = TableSubModel(context.getString(R.string.myanmar), "95")
        val subData30cent21 = TableSubModel(context.getString(R.string.netherlands), "31")
        val subData30cent22 = TableSubModel(context.getString(R.string.nicaragua), "505")
        val subData30cent23 = TableSubModel(context.getString(R.string.oman), "968")
        val subData30cent24 = TableSubModel(context.getString(R.string.san_marino), "378")
        val subData30cent25 = TableSubModel(context.getString(R.string.st_kitts_nevis), "1")
        val subData30cent26 = TableSubModel(context.getString(R.string.st_lucia), "1")
        val subData30cent27 = TableSubModel(context.getString(R.string.st_pierre_miquelon), "508")
        val subData30cent28 = TableSubModel(context.getString(R.string.st_vincent_grenadines), "1")
        val subData30cent29 = TableSubModel(context.getString(R.string.turks_caicos_islands), "1")
        val subData30cent30 = TableSubModel(context.getString(R.string.ukraine), "380")
        val subData30cent31 = TableSubModel(context.getString(R.string.united_arab_emirates), "44")
        val subData30cent32 = TableSubModel(context.getString(R.string.wallis_futuna), "681")
        tableDataSubList30cent.add(subData30cent1)
        tableDataSubList30cent.add(subData30cent2)
        tableDataSubList30cent.add(subData30cent3)
        tableDataSubList30cent.add(subData30cent4)
        tableDataSubList30cent.add(subData30cent5)
        tableDataSubList30cent.add(subData30cent6)
        tableDataSubList30cent.add(subData30cent7)
        tableDataSubList30cent.add(subData30cent8)
        tableDataSubList30cent.add(subData30cent9)
        tableDataSubList30cent.add(subData30cent10)
        tableDataSubList30cent.add(subData30cent11)
        tableDataSubList30cent.add(subData30cent12)
        tableDataSubList30cent.add(subData30cent13)
        tableDataSubList30cent.add(subData30cent14)
        tableDataSubList30cent.add(subData30cent15)
        tableDataSubList30cent.add(subData30cent16)
        tableDataSubList30cent.add(subData30cent17)
        tableDataSubList30cent.add(subData30cent18)
        tableDataSubList30cent.add(subData30cent19)
        tableDataSubList30cent.add(subData30cent20)
        tableDataSubList30cent.add(subData30cent21)
        tableDataSubList30cent.add(subData30cent22)
        tableDataSubList30cent.add(subData30cent23)
        tableDataSubList30cent.add(subData30cent24)
        tableDataSubList30cent.add(subData30cent25)
        tableDataSubList30cent.add(subData30cent26)
        tableDataSubList30cent.add(subData30cent27)
        tableDataSubList30cent.add(subData30cent28)
        tableDataSubList30cent.add(subData30cent29)
        tableDataSubList30cent.add(subData30cent30)
        tableDataSubList30cent.add(subData30cent31)
        tableDataSubList30cent.add(subData30cent32)
        val tableMode30 = TableModel("30 $strCent30", tableDataSubList30cent)

        //Data 50 Cents
        val tableDataSubList50cent = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.cents)
        val strCent50 = holder.binding.textCentsMin.text
        val subData50cent1 = TableSubModel(context.getString(R.string.albania), "355")
        val subData50cent2 = TableSubModel(context.getString(R.string.algeria), "213")
        val subData50cent3 = TableSubModel(context.getString(R.string.anguilla), "1")
        val subData50cent4 = TableSubModel(context.getString(R.string.austria_toll_shared), "43")
        val subData50cent5 = TableSubModel(context.getString(R.string.azerbaijan), "994")
        val subData50cent6 = TableSubModel(context.getString(R.string.belarus), "375")
        val subData50cent7 = TableSubModel(context.getString(R.string.belgium), "32")
        val subData50cent8 = TableSubModel(context.getString(R.string.benin), "229")
        val subData50cent9 = TableSubModel(context.getString(R.string.bosnia_herzegovina), "387")
        val subData50cent10 = TableSubModel(context.getString(R.string.bulgaria), "359")
        val subData50cent11 = TableSubModel(context.getString(R.string.burkina_faso), "226")
        val subData50cent12 = TableSubModel(context.getString(R.string.burundi), "257")
        val subData50cent13 = TableSubModel(context.getString(R.string.cape_verde), "238")
        val subData50cent14 = TableSubModel(context.getString(R.string.comoros), "269")
        val subData50cent15 = TableSubModel(context.getString(R.string.congo), "242")
        val subData50cent16 = TableSubModel(context.getString(R.string.croatia), "385")
        val subData50cent17 = TableSubModel(context.getString(R.string.dem_rep), "243")
        val subData50cent18 = TableSubModel(context.getString(R.string.djibouti), "253")
        val subData50cent19 = TableSubModel(context.getString(R.string.equatorial_guinea), "240")
        val subData50cent20 =
            TableSubModel(context.getString(R.string.estonia_special_services), "372")
        val subData50cent21 = TableSubModel(context.getString(R.string.fiji), "679")
        val subData50cent22 = TableSubModel(context.getString(R.string.finland), "358")
        val subData50cent23 = TableSubModel(context.getString(R.string.france), "33")
        val subData50cent24 = TableSubModel(context.getString(R.string.french_polynesia), "689")
        val subData50cent25 = TableSubModel(context.getString(R.string.grenada), "1")
        val subData50cent26 = TableSubModel(context.getString(R.string.guinea), "224")
        val subData50cent27 = TableSubModel(context.getString(R.string.guinea_bissau), "245")
        val subData50cent28 = TableSubModel(context.getString(R.string.haiti), "509")
        val subData50cent29 = TableSubModel(context.getString(R.string.pivory_coast), "225")
        val subData50cent30 = TableSubModel(context.getString(R.string.lesotho), "266")
        val subData50cent31 = TableSubModel(context.getString(R.string.liberia), "231")
        val subData50cent32 = TableSubModel(context.getString(R.string.macedonia), "389")
        val subData50cent33 = TableSubModel(context.getString(R.string.malawi), "265")
        val subData50cent34 = TableSubModel(context.getString(R.string.mali), "223")
        val subData50cent35 = TableSubModel(context.getString(R.string.micronesia), "691")
        val subData50cent36 = TableSubModel(context.getString(R.string.moldova), "373")
        val subData50cent37 = TableSubModel(context.getString(R.string.monaco), "377")
        val subData50cent38 = TableSubModel(context.getString(R.string.montenegro), "382")
        val subData50cent39 = TableSubModel(context.getString(R.string.morocco), "212")
        val subData50cent40 = TableSubModel(context.getString(R.string.mozambique), "258")
        val subData50cent41 = TableSubModel(context.getString(R.string.niger), "227")
        val subData50cent42 =
            TableSubModel(context.getString(R.string.niger_special_services), "227")
        val subData50cent43 = TableSubModel(context.getString(R.string.peru), "51")
        val subData50cent44 = TableSubModel(context.getString(R.string.portugal), "351")
        val subData50cent45 = TableSubModel(context.getString(R.string.rwanda), "351")
        val subData50cent46 = TableSubModel(context.getString(R.string.senegal), "221")
        val subData50cent47 = TableSubModel(context.getString(R.string.serbia), "221")
        val subData50cent48 = TableSubModel(context.getString(R.string.slovenia), "386")
        val subData50cent49 =
            TableSubModel(context.getString(R.string.south_sfrica_special_services), "27")
        val subData50cent50 = TableSubModel(context.getString(R.string.south_sudan), "221")
        val subData50cent51 = TableSubModel(context.getString(R.string.swaziland), "41")
        val subData50cent52 = TableSubModel(context.getString(R.string.tanzania), "255")
        val subData50cent53 = TableSubModel(context.getString(R.string.togo), "228")
        val subData50cent54 = TableSubModel(context.getString(R.string.uganda), "256")
        val subData50cent55 = TableSubModel(context.getString(R.string.zimbabwe), "263")

        tableDataSubList50cent.add(subData50cent1)
        tableDataSubList50cent.add(subData50cent2)
        tableDataSubList50cent.add(subData50cent3)
        tableDataSubList50cent.add(subData50cent4)
        tableDataSubList50cent.add(subData50cent5)
        tableDataSubList50cent.add(subData50cent6)
        tableDataSubList50cent.add(subData50cent7)
        tableDataSubList50cent.add(subData50cent8)
        tableDataSubList50cent.add(subData50cent9)
        tableDataSubList50cent.add(subData50cent10)
        tableDataSubList50cent.add(subData50cent11)
        tableDataSubList50cent.add(subData50cent12)
        tableDataSubList50cent.add(subData50cent13)
        tableDataSubList50cent.add(subData50cent14)
        tableDataSubList50cent.add(subData50cent15)
        tableDataSubList50cent.add(subData50cent16)
        tableDataSubList50cent.add(subData50cent17)
        tableDataSubList50cent.add(subData50cent18)
        tableDataSubList50cent.add(subData50cent19)
        tableDataSubList50cent.add(subData50cent20)
        tableDataSubList50cent.add(subData50cent21)
        tableDataSubList50cent.add(subData50cent22)
        tableDataSubList50cent.add(subData50cent23)
        tableDataSubList50cent.add(subData50cent24)
        tableDataSubList50cent.add(subData50cent25)
        tableDataSubList50cent.add(subData50cent26)
        tableDataSubList50cent.add(subData50cent27)
        tableDataSubList50cent.add(subData50cent28)
        tableDataSubList50cent.add(subData50cent29)
        tableDataSubList50cent.add(subData50cent30)
        tableDataSubList50cent.add(subData50cent31)
        tableDataSubList50cent.add(subData50cent32)
        tableDataSubList50cent.add(subData50cent33)
        tableDataSubList50cent.add(subData50cent34)
        tableDataSubList50cent.add(subData50cent35)
        tableDataSubList50cent.add(subData50cent36)
        tableDataSubList50cent.add(subData50cent37)
        tableDataSubList50cent.add(subData50cent38)
        tableDataSubList50cent.add(subData50cent39)
        tableDataSubList50cent.add(subData50cent40)
        tableDataSubList50cent.add(subData50cent41)
        tableDataSubList50cent.add(subData50cent42)
        tableDataSubList50cent.add(subData50cent43)
        tableDataSubList50cent.add(subData50cent44)
        tableDataSubList50cent.add(subData50cent45)
        tableDataSubList50cent.add(subData50cent46)
        tableDataSubList50cent.add(subData50cent47)
        tableDataSubList50cent.add(subData50cent48)
        tableDataSubList50cent.add(subData50cent49)
        tableDataSubList50cent.add(subData50cent50)
        tableDataSubList50cent.add(subData50cent51)
        tableDataSubList50cent.add(subData50cent52)
        tableDataSubList50cent.add(subData50cent53)
        tableDataSubList50cent.add(subData50cent54)
        tableDataSubList50cent.add(subData50cent55)
        val tableMode50 = TableModel("50 $strCent50", tableDataSubList50cent)

        //Data 1$
        val tableDataSubList1dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        var strCent1Dollar = holder.binding.textCentsMin.text
        val subData1dollar1 = TableSubModel(context.getString(R.string.cameroon), "237")
        val subData1dollar2 =
            TableSubModel(context.getString(R.string.central_african_republic), "236")
        val subData1dollar3 = TableSubModel(context.getString(R.string.chad), "235")
        val subData1dollar4 = TableSubModel(context.getString(R.string.chile), "56")
        val subData1dollar5 = TableSubModel(context.getString(R.string.cook_islands), "682")
        val subData1dollar6 = TableSubModel(context.getString(R.string.cuba), "53")
        val subData1dollar7 = TableSubModel(context.getString(R.string.east_timor), "670")
        val subData1dollar8 = TableSubModel(context.getString(R.string.estonia), "372")
        val subData1dollar9 = TableSubModel(context.getString(R.string.gabon), "241")
        val subData1dollar10 = TableSubModel(context.getString(R.string.gambia), "220")
        val subData1dollar11 = TableSubModel(context.getString(R.string.greenland), "299")
        val subData1dollar12 = TableSubModel(context.getString(R.string.kazakhstan), "7")
        val subData1dollar13 = TableSubModel(context.getString(R.string.latvia), "371")
        val subData1dollar14 = TableSubModel(context.getString(R.string.lithuania), "370")
        val subData1dollar15 = TableSubModel(context.getString(R.string.mauritania), "222")
        val subData1dollar16 = TableSubModel(context.getString(R.string.north_korea), "850")
        val subData1dollar17 = TableSubModel(context.getString(R.string.palau), "680")
        val subData1dollar18 = TableSubModel(context.getString(R.string.papua_new_guinea), "675")
        val subData1dollar19 = TableSubModel(context.getString(R.string.poland), "48")
        val subData1dollar20 =
            TableSubModel(context.getString(R.string.san_marino_special_services), "378")
        val subData1dollar21 = TableSubModel(context.getString(R.string.seychelles), "248")
        val subData1dollar22 = TableSubModel(context.getString(R.string.sierra_leone), "232")
        val subData1dollar23 = TableSubModel(context.getString(R.string.somalia), "252")
        val subData1dollar24 =
            TableSubModel(context.getString(R.string.south_sfrica_special_services), "27")
        val subData1dollar25 = TableSubModel(context.getString(R.string.suriname), "579")
        val subData1dollar26 = TableSubModel(context.getString(R.string.tonga), "579")
        val subData1dollar27 = TableSubModel(context.getString(R.string.tunisia), "216")
        val subData1dollar28 =
            TableSubModel(context.getString(R.string.universal_personal_TPG), "878")
        val subData1dollar29 = TableSubModel(context.getString(R.string.vanuatu), "678")
        val subData1dollar30 = TableSubModel(context.getString(R.string.western_samoa), "685")
        tableDataSubList1dollar.add(subData1dollar1)
        tableDataSubList1dollar.add(subData1dollar2)
        tableDataSubList1dollar.add(subData1dollar3)
        tableDataSubList1dollar.add(subData1dollar4)
        tableDataSubList1dollar.add(subData1dollar5)
        tableDataSubList1dollar.add(subData1dollar6)
        tableDataSubList1dollar.add(subData1dollar7)
        tableDataSubList1dollar.add(subData1dollar8)
        tableDataSubList1dollar.add(subData1dollar9)
        tableDataSubList1dollar.add(subData1dollar10)
        tableDataSubList1dollar.add(subData1dollar11)
        tableDataSubList1dollar.add(subData1dollar12)
        tableDataSubList1dollar.add(subData1dollar13)
        tableDataSubList1dollar.add(subData1dollar14)
        tableDataSubList1dollar.add(subData1dollar15)
        tableDataSubList1dollar.add(subData1dollar16)
        tableDataSubList1dollar.add(subData1dollar17)
        tableDataSubList1dollar.add(subData1dollar18)
        tableDataSubList1dollar.add(subData1dollar19)
        tableDataSubList1dollar.add(subData1dollar20)
        tableDataSubList1dollar.add(subData1dollar21)
        tableDataSubList1dollar.add(subData1dollar22)
        tableDataSubList1dollar.add(subData1dollar23)
        tableDataSubList1dollar.add(subData1dollar24)
        tableDataSubList1dollar.add(subData1dollar25)
        tableDataSubList1dollar.add(subData1dollar26)
        tableDataSubList1dollar.add(subData1dollar27)
        tableDataSubList1dollar.add(subData1dollar28)
        tableDataSubList1dollar.add(subData1dollar29)
        tableDataSubList1dollar.add(subData1dollar30)

        val tableMode1dollar = TableModel("1 $strCent1Dollar", tableDataSubList1dollar)
        //Data 1.5$
        val tableDataSubList1dollar5cents = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        var str1Dollar5Cent = holder.binding.textCentsMin.text
        val subData1dollar5cents1 = TableSubModel(context.getString(R.string.antarctica), "6721")
        val subData1dollar5cents2 =
            TableSubModel(context.getString(R.string.ascension_island), "247")
        val subData1dollar5cents3 =
            TableSubModel(context.getString(R.string.australia_territories), "6723")
        val subData1dollar5cents4 = TableSubModel(context.getString(R.string.barbados), "1")
        val subData1dollar5cents5 =
            TableSubModel(context.getString(R.string.belarus_special_services), "375")
        val subData1dollar5cents6 =
            TableSubModel(context.getString(R.string.cameroon_special_services), "237")
        val subData1dollar5cents7 =
            TableSubModel(context.getString(R.string.comoros_special_services), "269")
        val subData1dollar5cents8 =
            TableSubModel(context.getString(R.string.falkland_islands), "500")
        val subData1dollar5cents9 =
            TableSubModel(context.getString(R.string.ivory_coast_special_services), "225")
        val subData1dollar5cents10 = TableSubModel(context.getString(R.string.kiribati), "686")
        val subData1dollar5cents11 = TableSubModel(context.getString(R.string.madagascar), "261")
        val subData1dollar5cents12 = TableSubModel(context.getString(R.string.maldives), "960")
        val subData1dollar5cents13 = TableSubModel(context.getString(R.string.nauru), "674")
        val subData1dollar5cents14 = TableSubModel(context.getString(R.string.niue_island), "683")
        val subData1dollar5cents15 =
            TableSubModel(context.getString(R.string.solomon_islands), "677")
        val subData1dollar5cents16 = TableSubModel(context.getString(R.string.st_helena), "290")
        val subData1dollar5cents17 = TableSubModel(context.getString(R.string.tokelau), "690")
        val subData1dollar5cents18 = TableSubModel(context.getString(R.string.tuvalu), "688")

        tableDataSubList1dollar5cents.add(subData1dollar5cents1)
        tableDataSubList1dollar5cents.add(subData1dollar5cents2)
        tableDataSubList1dollar5cents.add(subData1dollar5cents3)
        tableDataSubList1dollar5cents.add(subData1dollar5cents4)
        tableDataSubList1dollar5cents.add(subData1dollar5cents5)
        tableDataSubList1dollar5cents.add(subData1dollar5cents6)
        tableDataSubList1dollar5cents.add(subData1dollar5cents7)
        tableDataSubList1dollar5cents.add(subData1dollar5cents8)
        tableDataSubList1dollar5cents.add(subData1dollar5cents9)
        tableDataSubList1dollar5cents.add(subData1dollar5cents10)
        tableDataSubList1dollar5cents.add(subData1dollar5cents11)
        tableDataSubList1dollar5cents.add(subData1dollar5cents12)
        tableDataSubList1dollar5cents.add(subData1dollar5cents13)
        tableDataSubList1dollar5cents.add(subData1dollar5cents14)
        tableDataSubList1dollar5cents.add(subData1dollar5cents15)
        tableDataSubList1dollar5cents.add(subData1dollar5cents16)
        tableDataSubList1dollar5cents.add(subData1dollar5cents17)
        tableDataSubList1dollar5cents.add(subData1dollar5cents18)


        val tableMode1dollar5cent =
            TableModel("1.5 $str1Dollar5Cent", tableDataSubList1dollar5cents)

        //Data 2$
        val tableDataSubList2dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent2Dollar = holder.binding.textCentsMin.text
        val subData2dollar = TableSubModel(context.getString(R.string.sao_tome_principe), "239")
        tableDataSubList2dollar.add(subData2dollar)
        val tableMode2dollar = TableModel("2 $strCent2Dollar", tableDataSubList2dollar)
        //Data 3$
        val tableDataSubList3dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent3Dollar = holder.binding.textCentsMin.text
        val subData3dollar =
            TableSubModel(context.getString(R.string.de_rep_of_congo_special_services), "243")
        val subData3dollar1 = TableSubModel(context.getString(R.string.inmarsat_unified), "870")
        tableDataSubList3dollar.add(subData3dollar)
        tableDataSubList3dollar.add(subData3dollar1)
        val tableMode3dollar = TableModel("3 $strCent3Dollar", tableDataSubList3dollar)
        val tableDataSubList4dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent4Dollar = holder.binding.textCentsMin.text
        val subData4dollar =
            TableSubModel(context.getString(R.string.russia_satellite_globaltel), "7")
        tableDataSubList4dollar.add(subData4dollar)
        val tableMode4dollar = TableModel("4 $strCent4Dollar", tableDataSubList4dollar)

        val tableDataSubList5dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent5Dollar = holder.binding.textCentsMin.text
        val subData5dollar = TableSubModel(context.getString(R.string.australia_territories), "672")
        val subData5dollar1 = TableSubModel(context.getString(R.string.diego_garcia), "246")
        tableDataSubList5dollar.add(subData5dollar)
        tableDataSubList5dollar.add(subData5dollar1)
        val tableMode5dollar = TableModel("5 $strCent5Dollar", tableDataSubList5dollar)

        val tableDataSubList6dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent6Dollar = holder.binding.textCentsMin.text
        val subData6dollar = TableSubModel(context.getString(R.string.global_network), "881")
        val subData6dollar1 = TableSubModel(context.getString(R.string.inmarsat_global), "870")
        val subData6dollar2 =
            TableSubModel(context.getString(R.string.international_networks_2), "883")
        tableDataSubList6dollar.add(subData6dollar)
        tableDataSubList6dollar.add(subData6dollar1)
        tableDataSubList6dollar.add(subData6dollar2)
        val tableMode6dollar = TableModel("6 $strCent6Dollar", tableDataSubList6dollar)

        val tableDataSubList8dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val strCent8Dollar = holder.binding.textCentsMin.text
        val subData8dollar = TableSubModel(context.getString(R.string.inmarsat_unified), "870")
        val subData8dollar1 =
            TableSubModel(context.getString(R.string.international_networks), "882")
        tableDataSubList8dollar.add(subData8dollar)
        tableDataSubList8dollar.add(subData8dollar1)
        val tableMode8dollar = TableModel("8 $strCent8Dollar", tableDataSubList8dollar)


        val tableDataSubList10dollar = ArrayList<TableSubModel>()
        holder.binding.textCentsMin.text = context.getString(R.string.dollar)
        val str10Dollar = holder.binding.textCentsMin.text
        val subData10dollar = TableSubModel(context.getString(R.string.inmarsat_HSD), "870")
        tableDataSubList10dollar.add(subData10dollar)
        val tableMode10dollar = TableModel("10 $str10Dollar", tableDataSubList10dollar)

        tableDataList.clear()
        tableDataList.add(tableModel)
        tableDataList.add(tableModel1)
        tableDataList.add(tableModel2)
        tableDataList.add(tableModel5)
        tableDataList.add(tableMode25)
        tableDataList.add(tableMode30)
        tableDataList.add(tableMode50)
        tableDataList.add(tableMode1dollar)
        tableDataList.add(tableMode1dollar5cent)
        tableDataList.add(tableMode2dollar)
        tableDataList.add(tableMode3dollar)
        tableDataList.add(tableMode4dollar)
        tableDataList.add(tableMode5dollar)
        tableDataList.add(tableMode6dollar)
        tableDataList.add(tableMode8dollar)
        tableDataList.add(tableMode10dollar)
        tableDataListDisplay.addAll(tableDataList)
        mAdapter.notifyDataSetChanged()
        Handler().postDelayed({
            tableDataListDisplay.clear()
        }, 200)

        // error_view.visibility = View.GONE
//        return tableDataList
        val tableCountry = ArrayList<CountryModel>()
        val subdata = CountryModel(
            SeatelUtils.translatForDialog(
                context, context.getString(R.string.all)
            ), ""
        )
        val country20 = CountryModel(context.getString(R.string.inmarsat_HSD), "870")
        val country1 = CountryModel(context.getString(R.string.china), "86")
        val country2 = CountryModel(
            context.getString(R.string.hong_kong_china), "852"
        )
        val country3 = CountryModel(context.getString(R.string.malaysia), "60")
        val country4 = CountryModel(context.getString(R.string.singapore), "65")
        val country5 = CountryModel(context.getString(R.string.thailand), "66")
        val country6 = CountryModel(context.getString(R.string.american_samoa), "1")
        val country7 = CountryModel(context.getString(R.string.bangladesh), "880")
        val country8 = CountryModel(context.getString(R.string.canada), "1")
        val country9 = CountryModel(context.getString(R.string.denmark), "45")
        val country10 = CountryModel(context.getString(R.string.guam), "1")
        val country11 = CountryModel(context.getString(R.string.hungary), "36")
        val country12 = CountryModel(context.getString(R.string.iceland), "354")
        val country13 = CountryModel(context.getString(R.string.india), "91")
        val country14 = CountryModel(context.getString(R.string.malta_Mobile), "356")
        val country15 = CountryModel(
            context.getString(R.string.mariana_islands), "1"
        )
        val country16 = CountryModel(context.getString(R.string.puerto_rico), "1")
        val country17 = CountryModel(context.getString(R.string.romania), "40")
        val country18 = CountryModel(context.getString(R.string.south_korea), "82")
        val country19 = CountryModel(context.getString(R.string.sweden), "46")
        val country21 = CountryModel(context.getString(R.string.australia), "61")
        val country22 = CountryModel(
            context.getString(R.string.australia_mobile_Satellite), "61"
        )
        val country23 = CountryModel(context.getString(R.string.bermuda), "1")
        val country24 = CountryModel(context.getString(R.string.brunei), "673")
//        val subData10cent5 = TableSubModel(context.getString(R.string.cambodia), "855")
        val country25 = CountryModel(
            context.getString(R.string.canada_Yukon_NW_Territories), "1"
        )
        val country26 = CountryModel(context.getString(R.string.costa_rica), "506")
        val country27 = CountryModel(
            context.getString(R.string.czech_republic), "420"
        )
        val country28 = CountryModel(
            context.getString(R.string.france_mobile_globalstar_special_services), "33"
        )
        val country29 = CountryModel(
            context.getString(R.string.french_guiana), "594"
        )
        val country30 = CountryModel(context.getString(R.string.greece), "30")
        val country31 = CountryModel(context.getString(R.string.guadeloupe), "590")
        val country32 = CountryModel(context.getString(R.string.indonesia), "62")
        val country33 = CountryModel(context.getString(R.string.japan), "81")
        val country34 = CountryModel(
            context.getString(R.string.kazakhstan_other_OLO), "7"
        )
        val country35 = CountryModel(context.getString(R.string.macau), "853")
        val country36 = CountryModel(context.getString(R.string.martinique), "596")
        val country37 = CountryModel(context.getString(R.string.mayotte), "262")
        val country38 = CountryModel(context.getString(R.string.mexico), "52")
        val country39 = CountryModel(context.getString(R.string.mongolia), "976")
        val country40 = CountryModel(context.getString(R.string.namibia), "264")
        val country41 = CountryModel(context.getString(R.string.new_zealand), "64")
        val country42 = CountryModel(
            context.getString(R.string.nigeria_mobile), "234"
        )
        val country43 = CountryModel(context.getString(R.string.pakistan), "92")
        val country44 = CountryModel(
            context.getString(R.string.reunion_island_mobile), "262"
        )
        val country45 = CountryModel(
            context.getString(R.string.russia_moscow_central), "7"
        )
        val country46 = CountryModel(context.getString(R.string.russia_other), "7")
        val country47 = CountryModel(
            context.getString(R.string.russia_st_petersburg), "7"
        )
        val country48 = CountryModel(
            context.getString(R.string.universal_disaster_relief), "888"
        )
        val country49 = CountryModel(context.getString(R.string.usa_lata), "1")
        val country50 = CountryModel(
            context.getString(R.string.usa_other_mainland), "1"
        )
        val country51 = CountryModel(context.getString(R.string.uzbekistan), "998")
        val country53 = CountryModel(context.getString(R.string.vietnam), "84")
        val country54 = CountryModel(context.getString(R.string.angola), "224")
        val country55 = CountryModel(context.getString(R.string.argentina), "54")
        val country56 = CountryModel(context.getString(R.string.bahrain), "973")
        val country57 = CountryModel(context.getString(R.string.bhutan), "975")
        val country58 = CountryModel(context.getString(R.string.cyprus), "357")
        val country59 = CountryModel(
            context.getString(R.string.dominican_republic), "1"
        )
        val country60 = CountryModel(context.getString(R.string.egypt), "20")
        val country61 = CountryModel(context.getString(R.string.ireland), "353")
        val country62 = CountryModel(
            context.getString(R.string.kuwait_mobile), "965"
        )
        val country63 = CountryModel(context.getString(R.string.laos), "856")
        val country64 = CountryModel(
            context.getString(R.string.liechtenstein_special_services), "423"
        )
        val country65 = CountryModel(context.getString(R.string.luxembourg), "352")
        val country66 = CountryModel(context.getString(R.string.nepal), "977")
        val country67 = CountryModel(context.getString(R.string.paraguay), "595")
        val country68 = CountryModel(
            context.getString(R.string.reunion_island_mobile), "262"
        )
        val country69 = CountryModel(context.getString(R.string.saudi_arabia), "966")
        val country70 = CountryModel(context.getString(R.string.slovakia), "421")
        val country71 = CountryModel(context.getString(R.string.st_maarten), "1721")
        val country72 = CountryModel(context.getString(R.string.taiwan), "886")
        val country73 = CountryModel(context.getString(R.string.venezuela), "58")
        val country74 = CountryModel(context.getString(R.string.iran), "98")
        val country75 = CountryModel(context.getString(R.string.jordan), "962")
        val country76 = CountryModel(context.getString(R.string.norway), "47")
        val country77 = CountryModel(context.getString(R.string.south_africa), "27")
        val country78 = CountryModel(context.getString(R.string.abkhazia), "7")
        val country79 = CountryModel(context.getString(R.string.afghanistan), "93")
        val country80 = CountryModel(context.getString(R.string.andorra), "376")
        val country81 = CountryModel(context.getString(R.string.aruba), "297")
        val country82 = CountryModel(context.getString(R.string.bahamas), "1")
        val country83 = CountryModel(context.getString(R.string.bolivia), "591")
        val country84 = CountryModel(context.getString(R.string.cayman_islands), "1")
        val country85 = CountryModel(context.getString(R.string.colombia), "57")
        val country86 = CountryModel(context.getString(R.string.ecuador), "593")
        val country87 = CountryModel(context.getString(R.string.el_salvador), "503")
        val country88 = CountryModel(
            context.getString(R.string.faroe_islands), "298"
        )
        val country89 = CountryModel(context.getString(R.string.ghana), "233")
        val country90 = CountryModel(context.getString(R.string.gibraltar), "350")
        val country91 = CountryModel(context.getString(R.string.guatemala), "502")
        val country92 = CountryModel(context.getString(R.string.honduras), "504")
        val country93 = CountryModel(context.getString(R.string.iraq), "964")
        val country94 = CountryModel(context.getString(R.string.israel), "972")
        val country95 = CountryModel(context.getString(R.string.kyrgyzstan), "996")
        val country96 = CountryModel(context.getString(R.string.lebanon), "961")
        val country97 = CountryModel(
            context.getString(R.string.marshall_islands), "692"
        )
        val country98 = CountryModel(
            context.getString(R.string.netherlands_antilles), "599"
        )
        val country99 = CountryModel(
            context.getString(R.string.new_caledonia), "687"
        )
        val country100 = CountryModel(context.getString(R.string.palestine), "970")
        val country101 = CountryModel(context.getString(R.string.panama), "507")
        val country102 = CountryModel(context.getString(R.string.philippines), "63")
        val country103 = CountryModel(context.getString(R.string.qatar), "974")
        val country104 = CountryModel(context.getString(R.string.rusia_other1), "7")
        val country105 = CountryModel(context.getString(R.string.spain), "34")
        val country106 = CountryModel(context.getString(R.string.sri_lanka), "94")
        val country107 = CountryModel(context.getString(R.string.sudan), "249")
        val country108 = CountryModel(context.getString(R.string.swaziland), "268")
        val country109 = CountryModel(context.getString(R.string.syria), "963")
        val country110 = CountryModel(context.getString(R.string.tadjikistan), "992")
        val country111 = CountryModel(
            context.getString(R.string.trinidad_tobago), "1"
        )
        val country112 = CountryModel(context.getString(R.string.turkey), "90")
        val country113 = CountryModel(context.getString(R.string.turkmenistan), "993")
        val country114 = CountryModel(
            context.getString(R.string.universal_disaster_relief), "888"
        )
        val country115 = CountryModel(
            context.getString(R.string.uruguay_mobile), "598"
        )
        val country116 = CountryModel(context.getString(R.string.yemen), "967")
        val country117 = CountryModel(
            context.getString(R.string.zambia_mobile), "260"
        )
        val country118 = CountryModel(
            context.getString(R.string.antigua_barbuda), "1"
        )
        val country119 = CountryModel(context.getString(R.string.armenia), "374")
        val country120 = CountryModel(context.getString(R.string.austria), "43")
        val country121 = CountryModel(context.getString(R.string.austria), "43")
        val country122 = CountryModel(context.getString(R.string.belize), "501")
        val country123 = CountryModel(context.getString(R.string.botswana), "267")
        val country124 = CountryModel(context.getString(R.string.brazil), "55")
        val country125 = CountryModel(
            context.getString(R.string.british_virgin_islands), "1"
        )
        val country126 = CountryModel(context.getString(R.string.dominica), "1")
        val country127 = CountryModel(context.getString(R.string.eritrea), "291")
        val country128 = CountryModel(context.getString(R.string.ethiopia), "251")
        val country129 = CountryModel(context.getString(R.string.georgia), "995")
        val country130 = CountryModel(context.getString(R.string.germany), "49")
        val country131 = CountryModel(context.getString(R.string.guyana), "592")
        val country132 = CountryModel(context.getString(R.string.italy), "39")
        val country133 = CountryModel(context.getString(R.string.jamaica), "1")
        val country134 = CountryModel(context.getString(R.string.kenya), "254")
        val country135 = CountryModel(context.getString(R.string.libya), "254")
        val country136 = CountryModel(context.getString(R.string.montserrat), "1")
        val country137 = CountryModel(context.getString(R.string.myanmar), "95")
        val country138 = CountryModel(context.getString(R.string.netherlands), "31")
        val country139 = CountryModel(context.getString(R.string.nicaragua), "505")
        val country140 = CountryModel(context.getString(R.string.oman), "968")
        val country141 = CountryModel(context.getString(R.string.san_marino), "378")
        val country142 = CountryModel(context.getString(R.string.st_kitts_nevis), "1")
        val country143 = CountryModel(context.getString(R.string.st_lucia), "1")
        val country144 = CountryModel(
            context.getString(R.string.st_pierre_miquelon), "508"
        )
        val country145 = CountryModel(
            context.getString(R.string.st_vincent_grenadines), "1"
        )
        val country146 = CountryModel(
            context.getString(R.string.turks_caicos_islands), "1"
        )
        val country147 = CountryModel(context.getString(R.string.ukraine), "380")
        val country148 = CountryModel(
            context.getString(R.string.united_arab_emirates), "44"
        )
        val country149 = CountryModel(
            context.getString(R.string.wallis_futuna), "681"
        )
        val country150 = CountryModel(context.getString(R.string.albania), "355")
        val country151 = CountryModel(context.getString(R.string.algeria), "213")
        val country152 = CountryModel(context.getString(R.string.anguilla), "1")
        val country153 = CountryModel(
            context.getString(R.string.austria_toll_shared), "43"
        )
        val country154 = CountryModel(context.getString(R.string.azerbaijan), "994")
        val country155 = CountryModel(context.getString(R.string.belarus), "375")
        val country156 = CountryModel(context.getString(R.string.belgium), "32")
        val country157 = CountryModel(context.getString(R.string.benin), "229")
        val country158 = CountryModel(
            context.getString(R.string.bosnia_herzegovina), "387"
        )
        val country159 = CountryModel(context.getString(R.string.bulgaria), "359")
        val country160 = CountryModel(context.getString(R.string.burkina_faso), "226")
        val country161 = CountryModel(context.getString(R.string.burundi), "257")
        val country162 = CountryModel(context.getString(R.string.cape_verde), "238")
        val country163 = CountryModel(context.getString(R.string.comoros), "269")
        val country164 = CountryModel(context.getString(R.string.congo), "242")
        val country165 = CountryModel(context.getString(R.string.croatia), "385")
        val country166 = CountryModel(context.getString(R.string.dem_rep), "243")
        val country167 = CountryModel(context.getString(R.string.djibouti), "253")
        val country168 = CountryModel(
            context.getString(R.string.equatorial_guinea), "240"
        )
        val country169 = CountryModel(
            context.getString(R.string.estonia_special_services), "372"
        )
        val country170 = CountryModel(context.getString(R.string.fiji), "679")
        val country171 = CountryModel(context.getString(R.string.finland), "358")
        val country172 = CountryModel(context.getString(R.string.france), "33")
        val country173 = CountryModel(
            context.getString(R.string.french_polynesia), "689"
        )
        val country174 = CountryModel(context.getString(R.string.grenada), "1")
        val country175 = CountryModel(context.getString(R.string.guinea), "224")
        val country176 = CountryModel(
            context.getString(R.string.guinea_bissau), "245"
        )
        val country177 = CountryModel(context.getString(R.string.haiti), "509")
        val country178 = CountryModel(context.getString(R.string.pivory_coast), "225")
        val country179 = CountryModel(context.getString(R.string.lesotho), "266")
        val country180 = CountryModel(context.getString(R.string.liberia), "231")
        val country181 = CountryModel(context.getString(R.string.macedonia), "389")
        val country182 = CountryModel(context.getString(R.string.malawi), "265")
        val country183 = CountryModel(context.getString(R.string.mali), "223")
        val country184 = CountryModel(context.getString(R.string.micronesia), "691")
        val country185 = CountryModel(context.getString(R.string.moldova), "373")
        val country186 = CountryModel(context.getString(R.string.monaco), "377")
        val country187 = CountryModel(context.getString(R.string.montenegro), "382")
        val country188 = CountryModel(context.getString(R.string.morocco), "212")
        val country189 = CountryModel(context.getString(R.string.mozambique), "258")
        val country190 = CountryModel(context.getString(R.string.niger), "227")
        val country191 = CountryModel(
            context.getString(R.string.niger_special_services), "227"
        )
        val country192 = CountryModel(context.getString(R.string.peru), "51")
        val country193 = CountryModel(context.getString(R.string.portugal), "351")
        val country194 = CountryModel(context.getString(R.string.rwanda), "351")
        val country195 = CountryModel(context.getString(R.string.senegal), "221")
        val country196 = CountryModel(context.getString(R.string.serbia), "221")
        val country197 = CountryModel(context.getString(R.string.slovenia), "386")
        val country198 = CountryModel(
            context.getString(R.string.south_sfrica_special_services), "27"
        )
        val country199 = CountryModel(context.getString(R.string.south_sudan), "221")
        val country200 = CountryModel(context.getString(R.string.swaziland), "41")
        val country201 = CountryModel(context.getString(R.string.tanzania), "255")
        val country202 = CountryModel(context.getString(R.string.togo), "228")
        val country203 = CountryModel(context.getString(R.string.uganda), "256")
        val country204 = CountryModel(context.getString(R.string.zimbabwe), "263")
        val country205 = CountryModel(context.getString(R.string.antarctica), "6721")
        val country206 = CountryModel(
            context.getString(R.string.ascension_island), "247"
        )
        val country207 = CountryModel(
            context.getString(R.string.australia_territories), "6723"
        )
        val country208 = CountryModel(context.getString(R.string.barbados), "1")
        val country209 = CountryModel(
            context.getString(R.string.belarus_special_services), "375"
        )
        val country210 = CountryModel(
            context.getString(R.string.cameroon_special_services), "237"
        )
        val country211 = CountryModel(
            context.getString(R.string.comoros_special_services), "269"
        )
        val country212 = CountryModel(
            context.getString(R.string.falkland_islands), "500"
        )
        val country213 = CountryModel(
            context.getString(R.string.ivory_coast_special_services), "225"
        )
        val country214 = CountryModel(context.getString(R.string.kiribati), "686")
        val country215 = CountryModel(context.getString(R.string.madagascar), "261")
        val country216 = CountryModel(context.getString(R.string.maldives), "960")
        val country217 = CountryModel(context.getString(R.string.nauru), "674")
        val country218 = CountryModel(context.getString(R.string.niue_island), "683")
        val country219 = CountryModel(
            context.getString(R.string.solomon_islands), "677"
        )
        val country220 = CountryModel(context.getString(R.string.st_helena), "290")
        val country221 = CountryModel(context.getString(R.string.tokelau), "690")
        val country222 = CountryModel(context.getString(R.string.tuvalu), "688")
        val country223 = CountryModel(
            context.getString(R.string.sao_tome_principe), "239"
        )
        val country224 = CountryModel(
            context.getString(R.string.de_rep_of_congo_special_services), "243"
        )
        val country225 = CountryModel(
            context.getString(R.string.inmarsat_unified), "870"
        )
        val country226 = CountryModel(
            context.getString(R.string.russia_satellite_globaltel), "7"
        )
        val country227 = CountryModel(
            context.getString(R.string.australia_territories), "672"
        )
        val country228 = CountryModel(context.getString(R.string.diego_garcia), "246")
        val country229 = CountryModel(
            context.getString(R.string.global_network), "881"
        )
        val country230 = CountryModel(
            context.getString(R.string.inmarsat_global), "870"
        )
        val country231 = CountryModel(
            context.getString(R.string.international_networks_2), "883"
        )
        val country232 = CountryModel(
            context.getString(R.string.inmarsat_unified), "870"
        )
        val country233 = CountryModel(
            context.getString(R.string.international_networks), "882"
        )
        val country234 = CountryModel(context.getString(R.string.inmarsat_HSD), "870")






        tableCountry.add(subdata)
        tableCountry.add(country1)
        tableCountry.add(country2)
        tableCountry.add(country3)
        tableCountry.add(country4)
        tableCountry.add(country5)
        tableCountry.add(country6)
        tableCountry.add(country7)
        tableCountry.add(country8)
        tableCountry.add(country9)
        tableCountry.add(country10)
        tableCountry.add(country11)
        tableCountry.add(country12)
        tableCountry.add(country13)
        tableCountry.add(country14)
        tableCountry.add(country15)
        tableCountry.add(country16)
        tableCountry.add(country17)
        tableCountry.add(country18)
        tableCountry.add(country19)
        tableCountry.add(country20)
        tableCountry.add(country21)
        tableCountry.add(country22)
        tableCountry.add(country23)
        tableCountry.add(country24)
        tableCountry.add(country25)
        tableCountry.add(country26)
        tableCountry.add(country27)
        tableCountry.add(country28)
        tableCountry.add(country29)
        tableCountry.add(country30)
        tableCountry.add(country31)
        tableCountry.add(country32)
        tableCountry.add(country33)
        tableCountry.add(country34)
        tableCountry.add(country35)
        tableCountry.add(country36)
        tableCountry.add(country37)
        tableCountry.add(country38)
        tableCountry.add(country39)
        tableCountry.add(country40)
        tableCountry.add(country41)
        tableCountry.add(country42)
        tableCountry.add(country43)
        tableCountry.add(country44)
        tableCountry.add(country45)
        tableCountry.add(country46)
        tableCountry.add(country47)
        tableCountry.add(country48)
        tableCountry.add(country49)
        tableCountry.add(country50)
        tableCountry.add(country51)
        tableCountry.add(country53)
        tableCountry.add(country54)
        tableCountry.add(country55)
        tableCountry.add(country56)
        tableCountry.add(country57)
        tableCountry.add(country58)
        tableCountry.add(country59)
        tableCountry.add(country60)
        tableCountry.add(country61)
        tableCountry.add(country62)
        tableCountry.add(country63)
        tableCountry.add(country64)
        tableCountry.add(country65)
        tableCountry.add(country66)
        tableCountry.add(country67)
        tableCountry.add(country68)
        tableCountry.add(country69)
        tableCountry.add(country70)
        tableCountry.add(country71)
        tableCountry.add(country72)
        tableCountry.add(country73)
        tableCountry.add(country74)
        tableCountry.add(country75)
        tableCountry.add(country76)
        tableCountry.add(country77)
        tableCountry.add(country78)
        tableCountry.add(country79)
        tableCountry.add(country80)
        tableCountry.add(country81)
        tableCountry.add(country82)
        tableCountry.add(country83)
        tableCountry.add(country84)
        tableCountry.add(country85)
        tableCountry.add(country86)
        tableCountry.add(country87)
        tableCountry.add(country88)
        tableCountry.add(country89)
        tableCountry.add(country90)
        tableCountry.add(country91)
        tableCountry.add(country92)
        tableCountry.add(country93)
        tableCountry.add(country94)
        tableCountry.add(country95)
        tableCountry.add(country96)
        tableCountry.add(country97)
        tableCountry.add(country98)
        tableCountry.add(country99)
        tableCountry.add(country99)
        tableCountry.add(country100)
        tableCountry.add(country101)
        tableCountry.add(country102)
        tableCountry.add(country103)
        tableCountry.add(country104)
        tableCountry.add(country105)
        tableCountry.add(country106)
        tableCountry.add(country107)
        tableCountry.add(country108)
        tableCountry.add(country109)
        tableCountry.add(country110)
        tableCountry.add(country111)
        tableCountry.add(country112)
        tableCountry.add(country113)
        tableCountry.add(country114)
        tableCountry.add(country115)
        tableCountry.add(country116)
        tableCountry.add(country117)
        tableCountry.add(country118)
        tableCountry.add(country119)
        tableCountry.add(country120)
        tableCountry.add(country121)
        tableCountry.add(country122)
        tableCountry.add(country123)
        tableCountry.add(country124)
        tableCountry.add(country125)
        tableCountry.add(country126)
        tableCountry.add(country127)
        tableCountry.add(country128)
        tableCountry.add(country129)
        tableCountry.add(country130)
        tableCountry.add(country131)
        tableCountry.add(country132)
        tableCountry.add(country133)
        tableCountry.add(country134)
        tableCountry.add(country135)
        tableCountry.add(country136)
        tableCountry.add(country136)
        tableCountry.add(country137)
        tableCountry.add(country138)
        tableCountry.add(country139)
        tableCountry.add(country140)
        tableCountry.add(country141)
        tableCountry.add(country142)
        tableCountry.add(country143)
        tableCountry.add(country144)
        tableCountry.add(country145)
        tableCountry.add(country146)
        tableCountry.add(country147)
        tableCountry.add(country148)
        tableCountry.add(country149)
        tableCountry.add(country150)
        tableCountry.add(country151)
        tableCountry.add(country152)
        tableCountry.add(country153)
        tableCountry.add(country154)
        tableCountry.add(country155)
        tableCountry.add(country156)
        tableCountry.add(country157)
        tableCountry.add(country158)
        tableCountry.add(country159)
        tableCountry.add(country160)
        tableCountry.add(country161)
        tableCountry.add(country162)
        tableCountry.add(country163)
        tableCountry.add(country164)
        tableCountry.add(country165)
        tableCountry.add(country166)
        tableCountry.add(country167)
        tableCountry.add(country168)
        tableCountry.add(country169)
        tableCountry.add(country170)
        tableCountry.add(country171)
        tableCountry.add(country172)
        tableCountry.add(country173)
        tableCountry.add(country173)
        tableCountry.add(country174)
        tableCountry.add(country175)
        tableCountry.add(country176)
        tableCountry.add(country177)
        tableCountry.add(country178)
        tableCountry.add(country179)
        tableCountry.add(country180)
        tableCountry.add(country181)
        tableCountry.add(country182)
        tableCountry.add(country183)
        tableCountry.add(country184)
        tableCountry.add(country185)
        tableCountry.add(country186)
        tableCountry.add(country187)
        tableCountry.add(country188)
        tableCountry.add(country189)
        tableCountry.add(country190)
        tableCountry.add(country191)
        tableCountry.add(country192)
        tableCountry.add(country193)
        tableCountry.add(country194)
        tableCountry.add(country195)
        tableCountry.add(country196)
        tableCountry.add(country197)
        tableCountry.add(country198)
        tableCountry.add(country199)
        tableCountry.add(country200)
        tableCountry.add(country201)
        tableCountry.add(country202)
        tableCountry.add(country203)
        tableCountry.add(country204)
        tableCountry.add(country205)
        tableCountry.add(country206)
        tableCountry.add(country207)
        tableCountry.add(country208)
        tableCountry.add(country209)
        tableCountry.add(country210)
        tableCountry.add(country211)
        tableCountry.add(country212)
        tableCountry.add(country213)
        tableCountry.add(country214)
        tableCountry.add(country215)
        tableCountry.add(country216)
        tableCountry.add(country217)
        tableCountry.add(country218)
        tableCountry.add(country219)
        tableCountry.add(country220)
        tableCountry.add(country221)
        tableCountry.add(country222)
        tableCountry.add(country223)
        tableCountry.add(country224)
        tableCountry.add(country225)
        tableCountry.add(country226)
//        tableCountry.add(country227)
        tableCountry.add(country228)
        tableCountry.add(country229)
        tableCountry.add(country230)
        tableCountry.add(country231)
        tableCountry.add(country232)
        tableCountry.add(country233)
        tableCountry.add(country234)


        //Adapter Spinner
        val adapter = ArrayAdapter<CountryModel>(
            context, android.R.layout.simple_spinner_item, tableCountry
        )

        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
        //  val sItems = findViewById<Spinner>(R.id.filter)
        // sItems.setBackgroundColor(Color.TRANSPARENT)
        holder.binding.filter.adapter = adapter
        holder.binding.filter.setSelection(0)
        holder.binding.filter.onItemSelectedListener =
            object : AdapterView.OnItemSelectedListener {
                override fun onItemSelected(
                    parent: AdapterView<*>, view: View, position: Int, id: Long
                ) {
                    val selectedItemText = parent.getItemAtPosition(position)
                    //Sort data when Click on Spinner
                    tableCountry.sortWith(Comparator { item, t1 ->
                        val s1 = item.destination
                        val s2 = t1.destination
                        s1.compareTo(s2, ignoreCase = true)

                    })
                    addAllToList(tableCountry)
                    if (parent.getItemAtPosition(position).equals(
                            SeatelUtils.translatForDialog(
                                context, context.getString(R.string.all)
                            )
                        )
                    ) {

                    } else {
                        //tableCountry[0].destination = context.getString(R.string.all)
                        tableDataListDisplay.addAll(tableDataList)
                        adapter.notifyDataSetChanged()
                        mAdapter.notifyDataSetChanged()


                    }
                    val itemCountry = adapter.getItem(position)
//              mAdapter.filter.filter(itemCountry.destination)
                    filter(itemCountry!!.destination)

                }

                override fun onNothingSelected(parent: AdapterView<*>) {
                }


            }

    }

    private fun addAllToList(tableCountry: ArrayList<CountryModel>) {
        var indexChange = 0
        for (i in tableCountry.indices) {
            if (TextUtils.equals(
                    tableCountry[i].destination, SeatelUtils.translatForDialog(
                        context, context.getString(R.string.all)
                    )
                )
            ) {
                indexChange = i
                break
            }
        }
        if (indexChange > 0) {
            val temp = tableCountry[indexChange]
            val temp2 = tableCountry[0]
            tableCountry[0] = temp
            tableCountry[indexChange] = temp2
        }
    }


}