Skip to content

Instantly share code, notes, and snippets.

@nizarfadlan
Last active April 1, 2024 13:31
Show Gist options
  • Select an option

  • Save nizarfadlan/8d8dcf64491da17dce0002975728bbac to your computer and use it in GitHub Desktop.

Select an option

Save nizarfadlan/8d8dcf64491da17dce0002975728bbac to your computer and use it in GitHub Desktop.
FollowFragment
class FollowFragment : Fragment() {
private var _binding: FragmentFollowBinding? = null
private val binding get() = _binding!!
private var username: String? = null
private var position: Int? = null
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
arguments?.let {
position = it.getInt(ARG_POSITION)
username = it.getString(ARG_USERNAME)
}
if (position == 1) {
// Follower
} else {
// Following
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentFollowBinding.inflate(inflater, container, false)
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
companion object {
const val ARG_POSITION = "arg_position"
const val ARG_USERNAME = "arg_username"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment