|
@@ -10,28 +10,19 @@ import androidx.fragment.app.Fragment
|
|
|
import androidx.lifecycle.lifecycleScope
|
|
import androidx.lifecycle.lifecycleScope
|
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
import androidx.recyclerview.widget.RecyclerView
|
|
|
-import im.angry.openeuicc.OpenEUICCApplication
|
|
|
|
|
import im.angry.openeuicc.R
|
|
import im.angry.openeuicc.R
|
|
|
-import im.angry.openeuicc.core.EuiccChannel
|
|
|
|
|
import im.angry.openeuicc.databinding.EuiccProfileBinding
|
|
import im.angry.openeuicc.databinding.EuiccProfileBinding
|
|
|
import im.angry.openeuicc.databinding.FragmentEuiccBinding
|
|
import im.angry.openeuicc.databinding.FragmentEuiccBinding
|
|
|
import kotlinx.coroutines.Dispatchers
|
|
import kotlinx.coroutines.Dispatchers
|
|
|
import kotlinx.coroutines.launch
|
|
import kotlinx.coroutines.launch
|
|
|
import kotlinx.coroutines.withContext
|
|
import kotlinx.coroutines.withContext
|
|
|
|
|
|
|
|
-class EuiccManagementFragment : Fragment() {
|
|
|
|
|
|
|
+class EuiccManagementFragment : Fragment(), EuiccFragmentMarker {
|
|
|
companion object {
|
|
companion object {
|
|
|
- fun newInstance(slotId: Int): EuiccManagementFragment {
|
|
|
|
|
- val instance = EuiccManagementFragment()
|
|
|
|
|
- instance.arguments = Bundle().apply {
|
|
|
|
|
- putInt("slotId", slotId)
|
|
|
|
|
- }
|
|
|
|
|
- return instance
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ fun newInstance(slotId: Int): EuiccManagementFragment =
|
|
|
|
|
+ newInstanceEuicc(EuiccManagementFragment::class.java, slotId)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private lateinit var channel: EuiccChannel
|
|
|
|
|
-
|
|
|
|
|
private var _binding: FragmentEuiccBinding? = null
|
|
private var _binding: FragmentEuiccBinding? = null
|
|
|
private val binding get() = _binding!!
|
|
private val binding get() = _binding!!
|
|
|
|
|
|
|
@@ -54,14 +45,13 @@ class EuiccManagementFragment : Fragment() {
|
|
|
LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
|
|
LinearLayoutManager(view.context, LinearLayoutManager.VERTICAL, false)
|
|
|
|
|
|
|
|
binding.fab.setOnClickListener {
|
|
binding.fab.setOnClickListener {
|
|
|
- ProfileDownloadFragment(channel).show(childFragmentManager, ProfileDownloadFragment.TAG)
|
|
|
|
|
|
|
+ ProfileDownloadFragment.newInstance(slotId)
|
|
|
|
|
+ .show(childFragmentManager, ProfileDownloadFragment.TAG)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
override fun onStart() {
|
|
override fun onStart() {
|
|
|
super.onStart()
|
|
super.onStart()
|
|
|
- val slotId = requireArguments().getInt("slotId")
|
|
|
|
|
- channel = (requireActivity().application as OpenEUICCApplication).euiccChannelRepo.availableChannels[slotId]
|
|
|
|
|
refresh()
|
|
refresh()
|
|
|
}
|
|
}
|
|
|
|
|
|