File tree Expand file tree Collapse file tree
ui/view/src/main/java/jp/dosukoi/ui/view Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package jp.dosukoi.ui.view.common
22
3- import android.app.Activity
43import android.content.Context
5- import android.content.Intent
6- import android.net.Uri
74import android.widget.Toast
8- import androidx.annotation.StringRes
95import jp.dosukoi.ui.view.R
106import retrofit2.HttpException
117import java.io.IOException
128
13- fun Activity.showToast (message : String ) {
14- Toast .makeText(this , message, Toast .LENGTH_SHORT ).show()
15- }
16-
17- fun Activity.showToast (@StringRes messageResId : Int ) {
18- val message = getString(messageResId)
19-
20- showToast(message)
21- }
22-
239fun Context.showErrorToast (throwable : Throwable ) {
2410 val message = when (throwable) {
2511 is IOException -> getString(R .string.io_exception)
@@ -31,8 +17,3 @@ fun Context.showErrorToast(throwable: Throwable) {
3117 }
3218 Toast .makeText(this , message, Toast .LENGTH_SHORT ).show()
3319}
34-
35- fun Activity.navigateChrome (url : String ) {
36- val intent = Intent (Intent .ACTION_VIEW , Uri .parse(url))
37- startActivity(intent)
38- }
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import coil.compose.LocalImageLoader
1111import dagger.hilt.android.AndroidEntryPoint
1212import jp.dosukoi.ui.view.common.CompositionLocalProvider
1313import jp.dosukoi.ui.view.common.appColors
14- import jp.dosukoi.ui.view.common.showErrorToast
1514import jp.dosukoi.ui.viewmodel.myPage.MyPageViewModel
1615import jp.dosukoi.ui.viewmodel.search.SearchViewModel
1716import javax.inject.Inject
@@ -47,17 +46,6 @@ class MainActivity : AppCompatActivity() {
4746 myPageViewModel.init ()
4847 }
4948
50- private fun handleEvent (event : MainViewModel .Event ) {
51- when (event) {
52- MainViewModel .Event .CompleteGetAccessToken -> {
53- myPageViewModel.onRetryClick()
54- }
55- is MainViewModel .Event .FailedFetch -> {
56- showErrorToast(event.throwable)
57- }
58- }
59- }
60-
6149 override fun onNewIntent (intent : Intent ? ) {
6250 super .onNewIntent(intent)
6351 val action = intent?.action
You can’t perform that action at this time.
0 commit comments