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 onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setHasOptionsMenu(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
| override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { | |
| inflater.inflate(R.menu.search_menu, menu) | |
| } |
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 NotificationsFragment : Fragment() { | |
| override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { | |
| // Inflate the layout for this fragment | |
| return inflater.inflate(R.layout.fragment_notifications, container, false) | |
| } | |
| override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
| super.onViewCreated(view, savedInstanceState) | |
| setupViews() |
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
| fun showBottomNavigation() | |
| { | |
| bottomNavView.visibility = View.VISIBLE | |
| } | |
| fun hideBottomNavigation() | |
| { | |
| bottomNavView.visibility = View.GONE | |
| } |
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 onAttach(context: Context) { | |
| super.onAttach(context) | |
| (activity as MainActivity).hideBottomNavigation() | |
| } | |
| override fun onDetach() { | |
| (activity as MainActivity).showBottomNavigation() | |
| super.onDetach() | |
| } |
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 var backPressedOnce = false | |
| override fun onBackPressed() | |
| { | |
| var navController = findNavController(R.id.fragNavHost) | |
| // Check if the current destination is actually the start sestination (Home screen) | |
| if (navController.graph.startDestination == navController.currentDestination?.id) | |
| { | |
| // Check if back is already pressed. If yes, then exit the app. |
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 : AppCompatActivity() | |
| { | |
| // Other methods of your Activity | |
| override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | |
| super.onActivityResult(requestCode, resultCode, data) | |
| // Capture Image with Camera | |
| if (requestCode == CAMERA_IMAGE_REQUEST && resultCode == Activity.RESULT_OK) { | |
| if (data != null) { |
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
| implementation 'androidx.activity:activity-ktx:1.2.0-alpha04' | |
| implementation 'androidx.fragment:fragment-ktx:1.3.0-alpha04' |