diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 6b4ad05..d0430cf 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
+ package="by.kirich1409.viewbindingdelegate.sample"
+ >
+ android:theme="@style/AppTheme"
+ >
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileActivity.kt b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileActivity.kt
index e7c366d..d99333a 100644
--- a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileActivity.kt
+++ b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileActivity.kt
@@ -3,12 +3,12 @@
package by.kirich1409.viewbindingdelegate.sample
import androidx.appcompat.app.AppCompatActivity
-import by.kirich1409.viewbindingdelegate.sample.databinding.ProfileBinding
+import by.kirich1409.viewbindingdelegate.sample.databinding.ActivityProfileBinding
import by.kirich1409.viewbindingdelegate.viewBinding
-class ProfileActivity : AppCompatActivity(R.layout.profile) {
+class ProfileActivity : AppCompatActivity(R.layout.activity_profile) {
- private val viewBindingUsingReflection: ProfileBinding by viewBinding(R.id.container)
+ private val viewBindingUsingReflection: ActivityProfileBinding by viewBinding(R.id.container)
- private val viewBindingWithoutReflection by viewBinding(ProfileBinding::bind, R.id.container)
+ private val viewBindingWithoutReflection by viewBinding(ActivityProfileBinding::bind, R.id.container)
}
diff --git a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment1.kt b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment1.kt
index 45be554..650d348 100644
--- a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment1.kt
+++ b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment1.kt
@@ -7,17 +7,17 @@ import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import by.kirich1409.viewbindingdelegate.dialogViewBinding
-import by.kirich1409.viewbindingdelegate.sample.databinding.ProfileBinding
+import by.kirich1409.viewbindingdelegate.sample.databinding.FragmentProfileBinding
class ProfileDialogFragment1 : DialogFragment() {
- private val viewBindingUsingReflection: ProfileBinding by dialogViewBinding(R.id.container)
+ private val viewBindingUsingReflection: FragmentProfileBinding by dialogViewBinding(R.id.container)
- private val viewBindingWithoutReflection by dialogViewBinding(ProfileBinding::bind, R.id.container)
+ private val viewBindingWithoutReflection by dialogViewBinding(FragmentProfileBinding::bind, R.id.container)
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return AlertDialog.Builder(requireContext())
- .setView(R.layout.profile)
+ .setView(R.layout.fragment_profile)
.create()
}
}
diff --git a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment2.kt b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment2.kt
index 7ebc807..284ada1 100644
--- a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment2.kt
+++ b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileDialogFragment2.kt
@@ -7,20 +7,20 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
-import by.kirich1409.viewbindingdelegate.sample.databinding.ProfileBinding
import by.kirich1409.viewbindingdelegate.viewBinding
import by.kirich1409.viewbindingdelegate.dialogViewBinding
+import by.kirich1409.viewbindingdelegate.sample.databinding.FragmentProfileBinding
class ProfileDialogFragment2 : DialogFragment() {
- private val viewBindingUsingReflection: ProfileBinding by dialogViewBinding(R.id.container)
+ private val viewBindingUsingReflection: FragmentProfileBinding by dialogViewBinding(R.id.container)
// Creating via default way will work too for that case
// private val viewBinding: ProfileBinding by viewBinding()
- private val viewBindingWithoutReflection by viewBinding(ProfileBinding::bind)
+ private val viewBindingWithoutReflection by viewBinding(FragmentProfileBinding::bind)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
- return inflater.inflate(R.layout.profile, container, false)
+ return inflater.inflate(R.layout.fragment_profile, container, false)
}
}
diff --git a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileFragment.kt b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileFragment.kt
index f610420..be2aa8e 100644
--- a/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileFragment.kt
+++ b/app/src/main/java/by/kirich1409/viewbindingdelegate/sample/ProfileFragment.kt
@@ -3,12 +3,17 @@
package by.kirich1409.viewbindingdelegate.sample
import androidx.fragment.app.Fragment
-import by.kirich1409.viewbindingdelegate.sample.databinding.ProfileBinding
+import by.kirich1409.viewbindingdelegate.sample.databinding.FragmentProfileBinding
import by.kirich1409.viewbindingdelegate.viewBinding
-class ProfileFragment : Fragment(R.layout.profile) {
+class ProfileFragment : Fragment(R.layout.fragment_profile) {
- private val viewBindingUsingReflection: ProfileBinding by viewBinding()
+ private val viewBindingUsingReflection: FragmentProfileBinding by viewBinding()
- private val viewBindingWithoutReflection by viewBinding(ProfileBinding::bind)
+ private val viewBindingWithoutReflection by viewBinding(FragmentProfileBinding::bind)
+
+ override fun onDestroyView() {
+ super.onDestroyView()
+ viewBindingUsingReflection.container.visibility
+ }
}
diff --git a/app/src/main/res/layout/activity_profile.xml b/app/src/main/res/layout/activity_profile.xml
new file mode 100644
index 0000000..765f6b2
--- /dev/null
+++ b/app/src/main/res/layout/activity_profile.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/profile.xml b/app/src/main/res/layout/fragment_profile.xml
similarity index 62%
rename from app/src/main/res/layout/profile.xml
rename to app/src/main/res/layout/fragment_profile.xml
index 46a3187..dcd39f4 100644
--- a/app/src/main/res/layout/profile.xml
+++ b/app/src/main/res/layout/fragment_profile.xml
@@ -1,27 +1,37 @@
-
\ No newline at end of file
+