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
| Start | |
| PKG-ONE: 😎😎😎 | |
| PKG-TWO: 😎😎😎 | |
| PKG-Three: 😎😎😎 | |
| End | |
| Process finished with exit code 0 |
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
| // ----> MainClass | |
| import pkgone.MyViewClass | |
| fun main() { | |
| println("Start") | |
| pkgone.MyViewClass().display() | |
| pkgtwo.MyViewClass().display() | |
| pkgthree.MyViewClass().display() | |
| println("End") | |
| } |
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 DownloadAssetsAnalytics @AssistedInject constructor( | |
| @Assisted("downloadTaskParams") val downloadTaskParams: DownloadTaskParams, | |
| @Assisted("errorOnDownload") val errorOnDownload: Boolean | |
| ){ | |
| // Where we have used the dependency | |
| } | |
| @AssistedFactory | |
| interface DownloadAssetsAnalyticsFactory { | |
| fun create( |
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 MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::inflate) { | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| binding.apply { | |
| btnInternalStorageImgId.setOnClickListener { | |
| openActivity(InternalStorageImagesActivity::class.java) | |
| } | |
| } | |
| } |
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 InternalStorageGalleryFragment : | |
| BaseFragment<FragmentInternalStorageGalleryBinding>(FragmentInternalStorageGalleryBinding::inflate) { | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| binding.test.text = "Hello view binding" | |
| } | |
| } |
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
| abstract class BaseActivity<VIEW_BINDING: ViewBinding>( | |
| private val inflate: InflateActivity<VIEW_BINDING> | |
| ) : AppCompatActivity() { | |
| lateinit var binding : VIEW_BINDING | |
| override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| binding = inflate.invoke(layoutInflater) | |
| setContentView(binding.root) |
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
| abstract class BaseFragment<VIEW_BINDING: ViewBinding>( | |
| private val inflate: InflateFragment<VIEW_BINDING> | |
| ) : Fragment() { | |
| private var _binding: VIEW_BINDING? = null | |
| val binding get() = _binding!! | |
| override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
| _binding = inflate.invoke(inflater, container, false) | |
| return binding.root |
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 CustomBoldTextView : AppCompatTextView { | |
| var FONT_NAME = "Roboto-Bold.ttf" | |
| constructor(context: Context, attrs: AttributeSet?, defStyle: Int) : super( | |
| context, | |
| attrs, | |
| defStyle | |
| ) { | |
| init(attrs, context) | |
| } |
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 CustomBoldTextView @JvmOverloads constructor(context: Context, | |
| attrs: AttributeSet? = null, | |
| defStyle: Int = androidx.appcompat.R.attr.titleTextStyle) : AppCompatTextView(context, attrs, defStyle) { | |
| private var FONT_NAME = "Roboto-Bold.ttf" | |
| init { init(attrs) } | |
| private fun init(attrs: AttributeSet?) { | |
| if (attrs != null) { | |
| val a = context.obtainStyledAttributes(attrs, R.styleable.CustomTextView) |