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 OnBoardingFragment : Fragment() { | |
| companion object { | |
| private const val ARG_POSITION = "ARG_POSITION" | |
| fun getInstance(position: Int) = OnBoardingFragment().apply { | |
| arguments = bundleOf(ARG_POSITION to position) | |
| } | |
| } |
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="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context=".OnBoardingFragment"> | |
| <!-- Image container --> | |
| <LinearLayout |
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 OnBoardingAdapter(activity: AppCompatActivity, private val itemsCount: Int) : | |
| FragmentStateAdapter(activity) { | |
| override fun getItemCount(): Int { | |
| return itemsCount | |
| } | |
| override fun createFragment(position: Int): Fragment { | |
| return OnBoardingFragment.getInstance(position) | |
| } |
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:id="@+id/on_boarding_main_container" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| tools:context=".OnBoardingActivity"> | |
| <androidx.viewpager2.widget.ViewPager2 |
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
| def viewPagerVersion = "1.0.0" | |
| implementation "androidx.viewpager2:viewpager2:$viewPagerVersion" | |
| def glide_version = "4.9.0" | |
| implementation "com.github.bumptech.glide:glide:$glide_version" | |
| implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version" | |
| kapt "com.github.bumptech.glide:compiler:$glide_version" |
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 GeneralInfoFragment : Fragment() { | |
| private lateinit var binding: FragmentGeneralInfoBinding | |
| override fun onCreateView(inflater: LayoutInflater, | |
| container: ViewGroup?, | |
| savedInstanceState: Bundle?): View? { | |
| binding = FragmentGeneralInfoBinding.inflate(inflater) | |
| 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 PhotoDetailsFragment : Fragment() { | |
| companion object { | |
| private val TAG = PhotoDetailsFragment::class.java.name | |
| const val PHOTO_ARG = "PHOTO_ARG" | |
| } | |
| private lateinit var binding: FragmentPhotoDetailsBinding | |
| private lateinit var photo: Photo | |
| private var shortAnimationDuration: Int = 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
| class HomeFragment : Fragment() { | |
| companion object { | |
| private val TAG = HomeFragment::class.java.name | |
| } | |
| private lateinit var binding: FragmentHomeBinding | |
| private var photosViewModel: PhotosViewModel? = null | |
| override fun onCreateView(inflater: LayoutInflater, |
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
| dataBinding { | |
| enabled = true | |
| } | |
| viewBinding { | |
| enabled = 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 PhotosRepository(val apiService: ApiService) { | |
| private val TAG = PhotosRepository::class.java.name | |
| var apiKey: String = BuildConfig.API_KEY | |
| suspend fun getPhotosFromApi(sol: Int, page: Int): Response<PhotosResponse>? { | |
| try { | |
| val response = apiService.getPhotos(sol, apiKey, page) | |
| response?.let { |