This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data class Problem(val problemNumber: Int, val problemName: String, val isLocked: Boolean) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| ) | |
| ) |