Sayfama Hoşgeldiniz
  1. Home /
  2. 2026
  3. / IP TV Kotlin

IP TV Kotlin

28 Apr 2026 Jekyll, Help

Bir kotlin fonksiyonudur.

@RequiresApi(Build.VERSION_CODES.S)
    private fun setupClickListeners(listView: ListView, categories: List<CategoryResult>, dialog: Dialog) {
        listView.onItemClickListener = OnItemThrottledClickListener { _, _, position, _ ->
            lifecycleScope.launch {


             //RESPONSE.İSSUCCESFULLY AŞAMASINDA CHECKDETAİL AŞAMALARINI KONTROL EDECEĞİM.TAMAMMEN KALDIRILACAK VE SUNUCU YÜKÜ HAFİFLETİLECEK.
             val networkResultvalue = networkObserver.isCurrentlyConnected()
             if (networkResultvalue)
              {
                val currentCategory = categories[position]
                val currentStoredCategoryPos = categoryManager.categoryNumberFlow.first()

                if (currentStoredCategoryPos == currentCategory.id) {
                    if (channels.isEmpty())
                    {
                        val alert =
                            AlertDialog.Builder(this@MainActivity, R.style.MaviOvalAlertTema)
                                .setMessage(R.string.category_no_channel)
                                .show()
                        val messageView = alert.findViewById<TextView>(android.R.id.message)
                        messageView?.gravity = Gravity.CENTER
                        val window = alert.window
                        val layoutParams = window!!.attributes
                        layoutParams.y = 350
                        window.attributes = layoutParams
                        delay(3000) // Handler yerine coroutine delay kullanıyoruz
                        alert.window!!.setGravity(Gravity.BOTTOM)
                        if (alert.isShowing) alert.dismiss()
                    }
                    dialog.dismiss()
                    return@launch
                }


                 //RESPONSE.İSSUCCESFULLY AŞAMASINDA CHECKDETAİL AŞAMALARINI KONTROL EDECEĞİM.TAMAMMEN KALDIRILACAK VE SUNUCU YÜKÜ HAFİFLETİLECEK.
                // bu aşamada post atarken kontrol edeceğiz.
                val sonuc = takeResultChannel(currentCategory.id)
                if (sonuc == null || sonuc!!.isEmpty()) {
                    dialog.dismiss()
                    return@launch
                }
                else
                {
                    sendchangecategory?.clear()
                    sendchangecategory =  ArrayList(sonuc)
                }
                val updatecategory = categories.find { it.id == currentStoredCategoryPos }
                if(updatecategory != null)
                {
                    dataStoreManager.updateLastPosition(updatecategory!!.id.toString(), channel_last)
                }

                val lastChannelPosition = dataStoreManager.getLastPosition(currentCategory.id.toString())
                currentCategoryName = currentCategory.name!!
                dialog.dismiss()
                epg_refres_flag = true
              if (responsechannel?.body()?.status != -1)
              {
                changecategory(currentCategory.id, lastChannelPosition,1)
                schedulePeroidicChanneladd(this@MainActivity,check_update ?: 15, isUpdateFromServer = true)


                if(currentCategory.epg != null)
                {
                    schedulePeriodicDownloadepg(this@MainActivity,currentCategory.epg_refresh!!.toLong(),currentCategory.epg!!,isUpdateFromServer = true)
                }

                showCategoryToast(currentCategory)

                if(currentCategory.epg != null)
                {
                    delay(15000)
                    epgMap = emptyMap()
                    epgMapcreated()
                    loadEpgData()
                }
              }
            }
            else
             {
                 dialog.dismiss()
                 showNoInternetDialog()
             }

          }
        }
    }

Kimim ?

Muhammet Faik Alada Next&NextStartda çalışmaktayım.