Skip to content

Instantly share code, notes, and snippets.

View Arunshaik2001's full-sized avatar

Ahron Arunshaik2001

View GitHub Profile
import Flutter
import UIKit
public class SwiftInternetCheckerPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
let channel = FlutterMethodChannel(name: "internet_checker", binaryMessenger: registrar.messenger())
let instance = SwiftInternetCheckerPlugin()
registrar.addMethodCallDelegate(instance, channel: channel)
}
class MainActivity : AppCompatActivity() , ProblemItemListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
setTitle(R.string.app_name)
val problemList = binding.problemsList
val mode = binding.mode
mode.text = getString(R.string.app_title)
class MainActivity : AppCompatActivity(), ProblemItemListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setTitle(R.string.app_name)
val problemList = findViewById<RecyclerView>(R.id.problemsList)
val mode = findViewById<TextView>(R.id.mode)
mode.text = getString(R.string.app_title)
val list = listOf(
data class Problem(val problemNumber: Int, val problemName: String, val isLocked: Boolean)
class ProblemsAdapter(private val problemsList: List<Problem>, private val listener: ProblemItemListener) :
RecyclerView.Adapter<ProblemsAdapter.ProblemItemViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ProblemItemViewHolder {
return ProblemItemViewHolder(
ItemViewBinding.inflate(
LayoutInflater.from(parent.context),
parent,
false
)
)