From a21ef195c9e067757fa0db7df3f3578097633e36 Mon Sep 17 00:00:00 2001 From: Jannik Date: Sun, 31 Jan 2021 22:11:08 +0100 Subject: [PATCH] add similar media to MediaFragment * parse similar media in AoDParser --- app/src/main/AndroidManifest.xml | 10 ++--- .../main/fragments/MediaSimilarFragment.kt | 18 --------- .../java/org/mosad/teapod/parser/AoDParser.kt | 18 ++++++++- .../{ => ui}/activity/SplashActivity.kt | 4 +- .../{ => ui}/activity/main/MainActivity.kt | 16 ++++---- .../activity/main/fragments/AboutFragment.kt | 2 +- .../main/fragments/AccountFragment.kt | 4 +- .../activity/main/fragments/HomeFragment.kt | 4 +- .../main/fragments/LibraryFragment.kt | 3 +- .../activity/main/fragments/MediaFragment.kt | 20 +++++++--- .../main/fragments/MediaFragmentEpisodes.kt | 6 +-- .../main/fragments/MediaFragmentSimilar.kt | 39 +++++++++++++++++++ .../activity/main/fragments/SearchFragment.kt | 3 +- .../main/viewmodel/MediaFragmentViewModel.kt | 5 ++- .../activity/onboarding/OnLoginFragment.kt | 2 +- .../activity/onboarding/OnWelcomeFragment.kt | 2 +- .../activity/onboarding/OnboardingActivity.kt | 4 +- .../activity/player/PlayerActivity.kt | 2 +- .../activity/player/PlayerViewModel.kt | 2 +- .../ui/components/EpisodesListPlayer.kt | 2 +- .../ui/components/LanguageSettingsPlayer.kt | 2 +- .../java/org/mosad/teapod/util/DataTypes.kt | 3 +- app/src/main/res/layout/activity_player.xml | 2 +- app/src/main/res/layout/fragment_about.xml | 2 +- app/src/main/res/layout/fragment_account.xml | 2 +- app/src/main/res/layout/fragment_home.xml | 2 +- app/src/main/res/layout/fragment_library.xml | 2 +- app/src/main/res/layout/fragment_media.xml | 2 +- .../res/layout/fragment_media_similar.xml | 23 +++++++---- app/src/main/res/layout/fragment_search.xml | 2 +- .../main/res/navigation/mobile_navigation.xml | 8 ++-- 31 files changed, 133 insertions(+), 83 deletions(-) delete mode 100644 app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaSimilarFragment.kt rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/SplashActivity.kt (80%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/MainActivity.kt (93%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/AboutFragment.kt (98%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/AccountFragment.kt (97%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/HomeFragment.kt (98%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/LibraryFragment.kt (94%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/MediaFragment.kt (91%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/MediaFragmentEpisodes.kt (92%) create mode 100644 app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentSimilar.kt rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/fragments/SearchFragment.kt (95%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/main/viewmodel/MediaFragmentViewModel.kt (93%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/onboarding/OnLoginFragment.kt (97%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/onboarding/OnWelcomeFragment.kt (95%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/onboarding/OnboardingActivity.kt (95%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/player/PlayerActivity.kt (99%) rename app/src/main/java/org/mosad/teapod/{ => ui}/activity/player/PlayerViewModel.kt (99%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 11b032f..794a418 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -13,7 +13,7 @@ android:supportsRtl="true" android:theme="@style/AppTheme.Dark"> @@ -23,24 +23,24 @@ when (row.select("th").text().toLowerCase(Locale.ROOT)) { "produktionsjahr" -> media.info.year = row.select("td").text().toInt() @@ -337,7 +337,21 @@ object AoDParser { } } - // parse additional information for tv shows the episode title (description) is loaded from the "api" + // similar titles from media page + media.info.similar = res.select("h2:contains(Ähnliche Animes)").next().select("li").mapNotNull { + val mediaId = it.select("a.thumbs").attr("href") + .substringAfterLast("/").toIntOrNull() + val mediaImage = it.select("a.thumbs > img").attr("src") + val mediaTitle = it.select("a").text() + + if (mediaId != null) { + ItemMedia(mediaId, mediaTitle, mediaImage) + } else { + null + } + } + + // additional information for tv shows the episode title (description) is loaded from the "api" if (media.type == MediaType.TVSHOW) { res.select("div.three-box-container > div.episodebox").forEach { episodebox -> // make sure the episode has a streaming link diff --git a/app/src/main/java/org/mosad/teapod/activity/SplashActivity.kt b/app/src/main/java/org/mosad/teapod/ui/activity/SplashActivity.kt similarity index 80% rename from app/src/main/java/org/mosad/teapod/activity/SplashActivity.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/SplashActivity.kt index 39b6744..c7dfa49 100644 --- a/app/src/main/java/org/mosad/teapod/activity/SplashActivity.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/SplashActivity.kt @@ -1,9 +1,9 @@ -package org.mosad.teapod.activity +package org.mosad.teapod.ui.activity import android.content.Intent import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import org.mosad.teapod.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.MainActivity class SplashActivity : AppCompatActivity() { diff --git a/app/src/main/java/org/mosad/teapod/activity/main/MainActivity.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/MainActivity.kt similarity index 93% rename from app/src/main/java/org/mosad/teapod/activity/main/MainActivity.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/MainActivity.kt index 1bd5b6d..19dd297 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/MainActivity.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/MainActivity.kt @@ -20,7 +20,7 @@ * */ -package org.mosad.teapod.activity.main +package org.mosad.teapod.ui.activity.main import android.content.Intent import android.os.Bundle @@ -31,27 +31,25 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.commit import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.callbacks.onDismiss -import com.afollestad.materialdialogs.utils.MDUtil.isLandscape import com.google.android.material.bottomnavigation.BottomNavigationView import kotlinx.coroutines.joinAll import kotlinx.coroutines.runBlocking import org.mosad.teapod.R import org.mosad.teapod.databinding.ActivityMainBinding import org.mosad.teapod.parser.AoDParser -import org.mosad.teapod.activity.player.PlayerActivity +import org.mosad.teapod.ui.activity.player.PlayerActivity import org.mosad.teapod.preferences.EncryptedPreferences import org.mosad.teapod.preferences.Preferences import org.mosad.teapod.ui.components.LoginDialog -import org.mosad.teapod.activity.main.fragments.AccountFragment -import org.mosad.teapod.activity.main.fragments.HomeFragment -import org.mosad.teapod.activity.main.fragments.LibraryFragment -import org.mosad.teapod.activity.main.fragments.SearchFragment -import org.mosad.teapod.activity.onboarding.OnboardingActivity +import org.mosad.teapod.ui.activity.main.fragments.AccountFragment +import org.mosad.teapod.ui.activity.main.fragments.HomeFragment +import org.mosad.teapod.ui.activity.main.fragments.LibraryFragment +import org.mosad.teapod.ui.activity.main.fragments.SearchFragment +import org.mosad.teapod.ui.activity.onboarding.OnboardingActivity import org.mosad.teapod.util.DataTypes import org.mosad.teapod.util.StorageController import org.mosad.teapod.util.exitAndRemoveTask import java.net.SocketTimeoutException -import kotlin.system.exitProcess import kotlin.system.measureTimeMillis class MainActivity : AppCompatActivity(), BottomNavigationView.OnNavigationItemSelectedListener { diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/AboutFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AboutFragment.kt similarity index 98% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/AboutFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AboutFragment.kt index ddba535..a30d129 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/AboutFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AboutFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.content.Intent import android.net.Uri diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/AccountFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AccountFragment.kt similarity index 97% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/AccountFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AccountFragment.kt index 1561b1c..61ca637 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/AccountFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/AccountFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.os.Bundle import android.util.Log @@ -9,7 +9,7 @@ import androidx.fragment.app.Fragment import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.list.listItemsSingleChoice import org.mosad.teapod.BuildConfig -import org.mosad.teapod.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.MainActivity import org.mosad.teapod.R import org.mosad.teapod.databinding.FragmentAccountBinding import org.mosad.teapod.parser.AoDParser diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/HomeFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/HomeFragment.kt similarity index 98% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/HomeFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/HomeFragment.kt index cf0fc0f..6e19d11 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/HomeFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/HomeFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.os.Bundle import android.util.Log @@ -11,7 +11,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import org.mosad.teapod.R -import org.mosad.teapod.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.MainActivity import org.mosad.teapod.databinding.FragmentHomeBinding import org.mosad.teapod.parser.AoDParser import org.mosad.teapod.util.ItemMedia diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/LibraryFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/LibraryFragment.kt similarity index 94% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/LibraryFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/LibraryFragment.kt index 50ba7b9..01ab191 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/LibraryFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/LibraryFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.os.Bundle import android.view.LayoutInflater @@ -9,7 +9,6 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import org.mosad.teapod.activity.main.MainActivity import org.mosad.teapod.databinding.FragmentLibraryBinding import org.mosad.teapod.parser.AoDParser import org.mosad.teapod.util.adapter.MediaItemAdapter diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragment.kt similarity index 91% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragment.kt index 6fda407..7fbfc64 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.graphics.Color import android.graphics.drawable.ColorDrawable @@ -17,14 +17,16 @@ import com.google.android.material.tabs.TabLayoutMediator import jp.wasabeef.glide.transformations.BlurTransformation import kotlinx.coroutines.* import org.mosad.teapod.R -import org.mosad.teapod.activity.main.MainActivity -import org.mosad.teapod.activity.main.viewmodel.MediaFragmentViewModel +import org.mosad.teapod.ui.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel import org.mosad.teapod.databinding.FragmentMediaBinding import org.mosad.teapod.util.* import org.mosad.teapod.util.DataTypes.MediaType /** - * TODO use a shared ViewModel for MediaFragment and it's sibling Fragments (episodes and similar) + * The media detail fragment. + * Note: the fragment is created only once, when selecting a similar title etc. + * therefore fragments may be not empty and model may be the old one */ class MediaFragment(private val mediaId: Int) : Fragment() { @@ -98,6 +100,10 @@ class MediaFragment(private val mediaId: Int) : Fragment() { Glide.with(requireContext()).load(R.drawable.ic_baseline_add_24).into(binding.imageMyListAction) } + // clear fragments, since it lives in onCreate scope (don't do this in onPause/onStop -> FragmentManager transaction) + fragments.clear() + pagerAdapter.notifyDataSetChanged() + // specific gui if (media.type == MediaType.TVSHOW) { // get next episode @@ -134,8 +140,10 @@ class MediaFragment(private val mediaId: Int) : Fragment() { } // if has similar titles - fragments.add(MediaSimilarFragment()) - pagerAdapter.notifyDataSetChanged() + if (media.info.similar.isNotEmpty()) { + fragments.add(MediaFragmentSimilar()) + pagerAdapter.notifyDataSetChanged() + } binding.frameLoading.visibility = View.GONE // hide loading indicator } diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragmentEpisodes.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentEpisodes.kt similarity index 92% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragmentEpisodes.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentEpisodes.kt index d16a50e..704610b 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/MediaFragmentEpisodes.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentEpisodes.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.os.Bundle import android.util.Log @@ -7,8 +7,8 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels -import org.mosad.teapod.activity.main.MainActivity -import org.mosad.teapod.activity.main.viewmodel.MediaFragmentViewModel +import org.mosad.teapod.ui.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel import org.mosad.teapod.databinding.FragmentMediaEpisodesBinding import org.mosad.teapod.util.Episode import org.mosad.teapod.util.adapter.EpisodeItemAdapter diff --git a/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentSimilar.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentSimilar.kt new file mode 100644 index 0000000..8c8079c --- /dev/null +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/MediaFragmentSimilar.kt @@ -0,0 +1,39 @@ +package org.mosad.teapod.ui.activity.main.fragments + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.Fragment +import androidx.fragment.app.activityViewModels +import org.mosad.teapod.databinding.FragmentMediaSimilarBinding +import org.mosad.teapod.ui.activity.main.viewmodel.MediaFragmentViewModel +import org.mosad.teapod.util.adapter.MediaItemAdapter +import org.mosad.teapod.util.showFragment + +class MediaFragmentSimilar : Fragment() { + + private lateinit var binding: FragmentMediaSimilarBinding + private val model: MediaFragmentViewModel by activityViewModels() + + private lateinit var adapterSimilar: MediaItemAdapter + + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { + binding = FragmentMediaSimilarBinding.inflate(inflater, container, false) + return binding.root + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + adapterSimilar = MediaItemAdapter(model.media.info.similar) + binding.recyclerMediaSimilar.adapter = adapterSimilar + + // set onItemClick only in adapter is initialized + if (this::adapterSimilar.isInitialized) { + adapterSimilar.onItemClick = { mediaId, _ -> + activity?.showFragment(MediaFragment(mediaId)) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/org/mosad/teapod/activity/main/fragments/SearchFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/SearchFragment.kt similarity index 95% rename from app/src/main/java/org/mosad/teapod/activity/main/fragments/SearchFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/SearchFragment.kt index 69ea9c4..57c43b1 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/fragments/SearchFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/fragments/SearchFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.fragments +package org.mosad.teapod.ui.activity.main.fragments import android.os.Bundle import android.view.LayoutInflater @@ -7,7 +7,6 @@ import android.view.ViewGroup import android.widget.SearchView import androidx.fragment.app.Fragment import kotlinx.coroutines.* -import org.mosad.teapod.activity.main.MainActivity import org.mosad.teapod.databinding.FragmentSearchBinding import org.mosad.teapod.parser.AoDParser import org.mosad.teapod.util.decoration.MediaItemDecoration diff --git a/app/src/main/java/org/mosad/teapod/activity/main/viewmodel/MediaFragmentViewModel.kt b/app/src/main/java/org/mosad/teapod/ui/activity/main/viewmodel/MediaFragmentViewModel.kt similarity index 93% rename from app/src/main/java/org/mosad/teapod/activity/main/viewmodel/MediaFragmentViewModel.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/main/viewmodel/MediaFragmentViewModel.kt index 9352049..de0be69 100644 --- a/app/src/main/java/org/mosad/teapod/activity/main/viewmodel/MediaFragmentViewModel.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/main/viewmodel/MediaFragmentViewModel.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.main.viewmodel +package org.mosad.teapod.ui.activity.main.viewmodel import android.app.Application import androidx.lifecycle.AndroidViewModel @@ -18,6 +18,9 @@ class MediaFragmentViewModel(application: Application) : AndroidViewModel(applic var tmdb = TMDBResponse() internal set + /** + * set media, tmdb and nextEpisode + */ suspend fun load(mediaId: Int) { media = AoDParser.getMediaById(mediaId) tmdb = TMDBApiController().search(media.info.title, media.type) diff --git a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnLoginFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnLoginFragment.kt similarity index 97% rename from app/src/main/java/org/mosad/teapod/activity/onboarding/OnLoginFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnLoginFragment.kt index b60646e..f65ab30 100644 --- a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnLoginFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnLoginFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.onboarding +package org.mosad.teapod.ui.activity.onboarding import android.os.Bundle import android.view.LayoutInflater diff --git a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnWelcomeFragment.kt b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnWelcomeFragment.kt similarity index 95% rename from app/src/main/java/org/mosad/teapod/activity/onboarding/OnWelcomeFragment.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnWelcomeFragment.kt index 28e221c..b51e6ed 100644 --- a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnWelcomeFragment.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnWelcomeFragment.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.onboarding +package org.mosad.teapod.ui.activity.onboarding import android.os.Bundle import android.view.LayoutInflater diff --git a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnboardingActivity.kt b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnboardingActivity.kt similarity index 95% rename from app/src/main/java/org/mosad/teapod/activity/onboarding/OnboardingActivity.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnboardingActivity.kt index 3c4488b..8087e98 100644 --- a/app/src/main/java/org/mosad/teapod/activity/onboarding/OnboardingActivity.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/onboarding/OnboardingActivity.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.onboarding +package org.mosad.teapod.ui.activity.onboarding import android.content.Intent import android.os.Bundle @@ -8,7 +8,7 @@ import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentActivity import androidx.viewpager2.adapter.FragmentStateAdapter import com.google.android.material.tabs.TabLayoutMediator -import org.mosad.teapod.activity.main.MainActivity +import org.mosad.teapod.ui.activity.main.MainActivity import org.mosad.teapod.databinding.ActivityOnboardingBinding class OnboardingActivity : AppCompatActivity() { diff --git a/app/src/main/java/org/mosad/teapod/activity/player/PlayerActivity.kt b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt similarity index 99% rename from app/src/main/java/org/mosad/teapod/activity/player/PlayerActivity.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt index d3e66ec..0999106 100644 --- a/app/src/main/java/org/mosad/teapod/activity/player/PlayerActivity.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerActivity.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.player +package org.mosad.teapod.ui.activity.player import android.animation.Animator import android.animation.AnimatorListenerAdapter diff --git a/app/src/main/java/org/mosad/teapod/activity/player/PlayerViewModel.kt b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerViewModel.kt similarity index 99% rename from app/src/main/java/org/mosad/teapod/activity/player/PlayerViewModel.kt rename to app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerViewModel.kt index 8a1eb89..4efb7c4 100644 --- a/app/src/main/java/org/mosad/teapod/activity/player/PlayerViewModel.kt +++ b/app/src/main/java/org/mosad/teapod/ui/activity/player/PlayerViewModel.kt @@ -1,4 +1,4 @@ -package org.mosad.teapod.activity.player +package org.mosad.teapod.ui.activity.player import android.app.Application import android.net.Uri diff --git a/app/src/main/java/org/mosad/teapod/ui/components/EpisodesListPlayer.kt b/app/src/main/java/org/mosad/teapod/ui/components/EpisodesListPlayer.kt index 259305f..cb51deb 100644 --- a/app/src/main/java/org/mosad/teapod/ui/components/EpisodesListPlayer.kt +++ b/app/src/main/java/org/mosad/teapod/ui/components/EpisodesListPlayer.kt @@ -6,7 +6,7 @@ import android.view.LayoutInflater import android.view.ViewGroup import android.widget.LinearLayout import org.mosad.teapod.databinding.PlayerEpisodesListBinding -import org.mosad.teapod.activity.player.PlayerViewModel +import org.mosad.teapod.ui.activity.player.PlayerViewModel import org.mosad.teapod.util.adapter.PlayerEpisodeItemAdapter class EpisodesListPlayer @JvmOverloads constructor( diff --git a/app/src/main/java/org/mosad/teapod/ui/components/LanguageSettingsPlayer.kt b/app/src/main/java/org/mosad/teapod/ui/components/LanguageSettingsPlayer.kt index a1b1d92..404ba7e 100644 --- a/app/src/main/java/org/mosad/teapod/ui/components/LanguageSettingsPlayer.kt +++ b/app/src/main/java/org/mosad/teapod/ui/components/LanguageSettingsPlayer.kt @@ -13,7 +13,7 @@ import android.widget.TextView import androidx.core.view.children import org.mosad.teapod.R import org.mosad.teapod.databinding.PlayerLanguageSettingsBinding -import org.mosad.teapod.activity.player.PlayerViewModel +import org.mosad.teapod.ui.activity.player.PlayerViewModel import java.util.* class LanguageSettingsPlayer @JvmOverloads constructor( diff --git a/app/src/main/java/org/mosad/teapod/util/DataTypes.kt b/app/src/main/java/org/mosad/teapod/util/DataTypes.kt index bc27719..ea6e59e 100644 --- a/app/src/main/java/org/mosad/teapod/util/DataTypes.kt +++ b/app/src/main/java/org/mosad/teapod/util/DataTypes.kt @@ -62,7 +62,8 @@ data class Info( var description: String = "", var year: Int = 0, var age: Int = 0, - var episodesCount: Int = 0 + var episodesCount: Int = 0, + var similar: List = listOf() ) /** diff --git a/app/src/main/res/layout/activity_player.xml b/app/src/main/res/layout/activity_player.xml index 050d442..5a8f6bd 100644 --- a/app/src/main/res/layout/activity_player.xml +++ b/app/src/main/res/layout/activity_player.xml @@ -7,7 +7,7 @@ android:layout_height="match_parent" android:background="#000000" android:keepScreenOn="true" - tools:context=".activity.player.PlayerActivity"> + tools:context=".ui.activity.player.PlayerActivity"> + tools:context=".ui.activity.main.fragments.AboutFragment"> + tools:context=".ui.activity.main.fragments.AccountFragment"> + tools:context=".ui.activity.main.fragments.HomeFragment"> + tools:context=".ui.activity.main.fragments.LibraryFragment"> + tools:context=".ui.activity.main.fragments.MediaFragment"> - + app:layout_constraintTop_toTopOf="parent" + app:spanCount="2" + tools:listitem="@layout/item_media" /> + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 02fd428..6427560 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -5,7 +5,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="?themePrimary" - tools:context=".activity.main.fragments.SearchFragment"> + tools:context=".ui.activity.main.fragments.SearchFragment">