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 BasicCoroutineFragment : Fragment(R.layout.fragment_coroutine_basic) { | |
private val TAG = this::class.simpleName | |
private val coroutineScopeMainImmediate = CoroutineScope(Dispatchers.Main.immediate) | |
/** Job 타입 변수 추가 */ | |
private var job: Job? = null | |
private lateinit var button: Button | |
private lateinit var tvTime: TextView | |
private lateinit var tvMessage: TextView |
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
button.setOnClickListener { | |
coroutineScopeMainImmediate.launch { | |
tvMessage.text = "Started" | |
button.isEnabled = false | |
runTime() | |
tvMessage.text = "Ended" | |
button.isEnabled = true | |
} | |
} |
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 BasicCoroutineFragment : Fragment(R.layout.fragment_coroutine_basic) { | |
private val TAG = this::class.simpleName | |
private val coroutineScopeMainImmediate = CoroutineScope(Dispatchers.Main.immediate) | |
private lateinit var button: Button | |
private lateinit var tvTime: TextView | |
private lateinit var tvMessage: TextView | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
initViews(view) |
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
private fun testLifecycleScope() { | |
println("$TAG Zero") | |
lifecycleScope.launch { | |
println("$TAG First") | |
} | |
println("$TAG Second") | |
} |
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 BasicCoroutineFragment : Fragment(R.layout.fragment_coroutine_basic) { | |
private val TAG = this::class.simpleName | |
private val coroutineScopeMain = CoroutineScope(Dispatchers.Main) | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
testDispatchersMain() | |
} |
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 AppDelegate: NSObject, UIApplicationDelegate { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { | |
/** Facebook */ | |
ApplicationDelegate.shared.application( | |
application, | |
didFinishLaunchingWithOptions: launchOptions | |
) | |
return true | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content"> | |
<TextView | |
android:id="@+id/textView" | |
android:layout_width="wrap_content" |
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
package com.dj.dialoglifecycletest | |
import android.app.Dialog | |
import android.content.Context | |
import android.os.Bundle | |
import kotlinx.android.synthetic.main.dialog_custom.* | |
class CustomDialog(context: Context) : Dialog(context) { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
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
override fun onPause() { | |
super.onPause() | |
Toast.makeText(this, "onPause Called!", Toast.LENGTH_SHORT).show() | |
} |
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
private fun showCustomToast(){ | |
val inflater = layoutInflater | |
val container = findViewById<LinearLayout>(R.id.custom_toast_container) | |
val layout = inflater.inflate(R.layout.custom_toast, container) | |
val text = layout.findViewById<TextView>(R.id.text) | |
text.text = "맞춤 토스트 만들기!" | |
with(Toast(applicationContext)){ | |
setGravity(Gravity.TOP, 0 , 200) | |
duration = Toast.LENGTH_LONG |
NewerOlder