Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

使っていないコルーチンスコープの削除 #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions Raichou/app/src/main/java/dev/mixi/raichou/HomeListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.observe
import androidx.navigation.Navigation
import dev.mixi.raichou.databinding.FragmentHomeListBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel

/**
* A simple [Fragment] subclass.
*/
class HomeListFragment : Fragment(), CoroutineScope by MainScope() {
class HomeListFragment : Fragment() {

val viewModel by viewModels<HomeListViewModel>()
lateinit var binding: FragmentHomeListBinding
Expand All @@ -43,9 +40,4 @@ class HomeListFragment : Fragment(), CoroutineScope by MainScope() {
}
}
}

override fun onDestroy() {
super.onDestroy()
cancel()
}
}
4 changes: 1 addition & 3 deletions Raichou/app/src/main/java/dev/mixi/raichou/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import dev.mixi.raichou.databinding.ActivityMainBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope

class MainActivity : AppCompatActivity(), CoroutineScope by MainScope() {
class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import androidx.fragment.app.viewModels
import androidx.lifecycle.observe
import com.google.android.material.snackbar.Snackbar
import dev.mixi.raichou.databinding.FragmentMediumPostBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.cancel
import timber.log.Timber

/**
* A simple [Fragment] subclass.
*/
class MediumPostFragment : Fragment(), CoroutineScope by MainScope() {
class MediumPostFragment : Fragment() {

lateinit var binding: FragmentMediumPostBinding
val viewModel by viewModels<MediumPostViewModel>()
Expand Down Expand Up @@ -57,11 +54,6 @@ class MediumPostFragment : Fragment(), CoroutineScope by MainScope() {
showListWithPermissionCheck()
}

override fun onDestroy() {
super.onDestroy()
cancel()
}

fun post() {
val adapter = binding.list.adapter as ImageListAdapter
val list = adapter.getSelectedImageList()
Expand Down