-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from CATReloaded/m-base
Create base classes
- Loading branch information
Showing
9 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class BaseActivity : AppCompatActivity() { | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
import androidx.annotation.LayoutRes | ||
import androidx.fragment.app.Fragment | ||
|
||
class BaseFragment(@LayoutRes layout: Int) : Fragment(layout) { | ||
|
||
} |
18 changes: 18 additions & 0 deletions
18
app/src/main/java/cat/reloaded/tasks/base/BaseViewModel.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
import androidx.lifecycle.ViewModel | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.SupervisorJob | ||
import kotlin.coroutines.CoroutineContext | ||
|
||
abstract class BaseViewModel<VA : ViewAction> : ViewModel(), CoroutineScope { | ||
|
||
private val job = SupervisorJob() | ||
override val coroutineContext: CoroutineContext = Dispatchers.IO + job | ||
abstract fun processAction(viewAction: VA) | ||
override fun onCleared() { | ||
job.cancel() | ||
super.onCleared() | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
abstract class BaseViewState |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
import android.app.Application | ||
|
||
class CatApplication : Application() { | ||
|
||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package cat.reloaded.tasks.base | ||
|
||
interface ViewAction |