This mobile application is a guide application. Users who want to have information about places to visit can benefit from this application.
- You can explore new places in it.
- You can read detailed articles about the places you have discovered.
- You can like discovered places or save to remember them later.
- You can make new searches and get information about the results.
- You can browse pictures of all places by clicking on them.
- All classes are isolated.
- 2 APIs were used in the whole project.
- Room database is used.
- API key and endpoint addresses are hidden.
- DependencyInject has been used literally.
- I used
Resourcein Flow. - I used
@string.xml,@dimen.xml,@colors.xml.
- Okhttp
- Retrofit
- Kotlin Coroutines
- ViewModel
- Glide
- Dagger & Hilt
- Room
- DataBinding
- Material Design
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
- Attention has been paid to the distinction between Fragment & ViewModel.
- Observe operations are done in the fragment.
private fun initializeDeals() {
//Observer deals.
homeViewModel.attractionsLiveData.observe(viewLifecycleOwner) {
binding.dealsRecyclerview.adapter = HomeDealsAdapter(it)
}
//Observe loading.
homeViewModel.loading.observe(viewLifecycleOwner) {
if (it) {
binding.dealsRecyclerview.visibility = View.GONE
binding.dealsErrorText.visibility = View.GONE
binding.dealsProgressBar.visibility = View.VISIBLE
} else {
binding.dealsRecyclerview.visibility = View.VISIBLE
binding.dealsErrorText.visibility = View.GONE
binding.dealsProgressBar.visibility = View.GONE
}
}
//Observe error.
homeViewModel.error.observe(viewLifecycleOwner) {
if (it) {
binding.dealsRecyclerview.visibility = View.GONE
binding.dealsErrorText.visibility = View.VISIBLE
} else {
binding.dealsRecyclerview.visibility = View.VISIBLE
binding.dealsErrorText.visibility = View.GONE
}
}
}- Updates can be made by searching for
Region, Country, Venue, etc.in this screen. - When
Destinationsis scrolled, new items will start loading. SearchViewwill transferSearchResultFragmentwhen any text is written and the written text will be transferred there.
Note: Example function in view model.
fun addBookmark(
attraction: Attraction,
onBookmarkAddButtonClick: (Attraction) -> Unit
) {
viewModelScope.launch {
dbRepository.insert(attraction).collect() {
when (it) {
is Resource.Loading -> {
loading.postValue(true)
error.postValue(false)
}
is Resource.Error -> {
loading.postValue(false)
error.postValue(true)
}
is Resource.Success -> {
loading.postValue(false)
error.postValue(false)
bookmarkList.add(attraction.id)
onBookmarkAddButtonClick(attraction)
}
}
}
}
}- You can add the places you want to travel and choose your round trip days.
- The
Attractionsyou have registered are listed in theBookmarksection.
- You can get historical information about countries and read blog posts.
- You can select the country you want to get information from in the
TabLayoutsection.
- You can get historical information about countries and read blog posts.
- You can select the country you want to get information from in the
TabLayoutsection.
- Shows the classes
Article,Attraction,Country,Destination,MockObjectandTripin it. For this, I created an interface namedDetailObjectasDependecy Revisionand implemented it to all classes. - We send the implemented class with
DataBinding.
<data>
<variable
name="detailObject"
type="com.furkanbalci.travelguide.di.DetailObject" />
</data>I created an annotation class to return 2 Retrofit objects.
...
@MockApi
@Provides
@Singleton
fun provideMockService(@MockApi retrofit: Retrofit): MockApiService {
return retrofit.create(MockApiService::class.java)
}
@TriposoApi
@Provides
@Singleton
fun provideTriposoService(@TriposoApi retrofit: Retrofit): TriposoApiService {
return retrofit.create(TriposoApiService::class.java)
}
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class MockApi
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class TriposoApi























