diff options
Diffstat (limited to 'app')
17 files changed, 744 insertions, 689 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt index 734e917..b7c1d0e 100644 --- a/app/src/main/java/xyz/adjutor/aniki/HomePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/HomePage.kt @@ -11,8 +11,8 @@ import androidx.navigation.fragment.findNavController class HomePage : Fragment() { override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment return inflater.inflate(R.layout.home_page, container, false) @@ -20,7 +20,7 @@ class HomePage : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - + view.findViewById<Button>(R.id.button_top_manga).setOnClickListener { findNavController().navigate(R.id.action_HomePage_to_TopMangaPage) } diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/RestAnimeResponse.kt b/app/src/main/java/xyz/adjutor/aniki/anime/RestAnimeResponse.kt index aa15dfd..b449b31 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/RestAnimeResponse.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/RestAnimeResponse.kt @@ -2,10 +2,11 @@ package xyz.adjutor.aniki.anime import com.google.gson.annotations.SerializedName -class RestAnimeResponse{ //only kept the infos I didn't have and that were interesting to me. +class RestAnimeResponse { //only kept the infos I didn't have and that were interesting to me. @SerializedName("mal_id") var mal_id: Int? = null + @SerializedName("synopsis") var synopsis: String? = null } diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/DetailTopAnimeActivity.kt b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/DetailTopAnimeActivity.kt index 0db1ca1..acbbd4d 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/DetailTopAnimeActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/DetailTopAnimeActivity.kt @@ -26,8 +26,8 @@ class DetailTopAnimeActivity : AppCompatActivity() { private var baseUrl = "https://api.jikan.moe/" var sharedPreferences: SharedPreferences? = null private val gson = GsonBuilder() - .setLenient() - .create() + .setLenient() + .create() private val intentAnimeId = "theanimeid" private val intentAnimeTitle = "theanimetitle" @@ -79,7 +79,7 @@ class DetailTopAnimeActivity : AppCompatActivity() { .into(ivImage) //using null as a string because it has been converted to a string before - tvEpisodes.text = if (animeEpisodes != "null"){ + tvEpisodes.text = if (animeEpisodes != "null") { animeEpisodes } else { fieldIsNull() @@ -87,7 +87,7 @@ class DetailTopAnimeActivity : AppCompatActivity() { tvStartDate.text = animeStartDate - tvEndDate.text = if (animeEndDate != "null"){ + tvEndDate.text = if (animeEndDate != "null") { animeEndDate } else { fieldIsNull() @@ -96,7 +96,7 @@ class DetailTopAnimeActivity : AppCompatActivity() { tvUrl.text = animeUrl val anime: RestAnimeResponse? = getDataFromCache(animeId.toString()) - if(anime != null ){ + if (anime != null) { showDetail(anime) } else { //taking the API's fields I want and displaying them @@ -106,9 +106,9 @@ class DetailTopAnimeActivity : AppCompatActivity() { } private fun getDataFromCache(animeId: String): RestAnimeResponse? { - val jsonAnime: String?= sharedPreferences?.getString(animeId, null) + val jsonAnime: String? = sharedPreferences?.getString(animeId, null) - return if(jsonAnime == null) { + return if (jsonAnime == null) { null } else { val type: Type = object : TypeToken<RestAnimeResponse>() {}.type @@ -119,16 +119,19 @@ class DetailTopAnimeActivity : AppCompatActivity() { private fun makeApiCall(BASE_URL: String, animeId: String) { val retrofit = Retrofit.Builder() - .baseUrl(BASE_URL) - .addConverterFactory(GsonConverterFactory.create(gson)) - .build() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() val service = retrofit.create(AnimeApi::class.java) val call = service.getAnimeData(animeId) //based on the id call.enqueue(object : Callback<RestAnimeResponse> { - override fun onResponse(call: Call<RestAnimeResponse>, response: Response<RestAnimeResponse>) { - if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty + override fun onResponse( + call: Call<RestAnimeResponse>, + response: Response<RestAnimeResponse> + ) { + if (response.isSuccessful && response.body() != null) { //if the code returned is >= 200 and < 300 AND the the body ain't empty val anime = response.body() //getting the RestAnimeResponse fields saveList(anime) @@ -157,7 +160,8 @@ class DetailTopAnimeActivity : AppCompatActivity() { fun showError(text: String) { Toast.makeText(this, text, Toast.LENGTH_LONG).show() } - private fun fieldIsNull(): String{ + + private fun fieldIsNull(): String { return "Unknown" } @@ -165,8 +169,8 @@ class DetailTopAnimeActivity : AppCompatActivity() { val jsonString: String = gson.toJson(anime) sharedPreferences - ?.edit() - ?.putString(anime?.mal_id.toString(), jsonString) - ?.apply() + ?.edit() + ?.putString(anime?.mal_id.toString(), jsonString) + ?.apply() } }
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnime.kt b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnime.kt index f8093f6..5202227 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnime.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnime.kt @@ -3,24 +3,32 @@ package xyz.adjutor.aniki.anime.topanime import com.google.gson.annotations.SerializedName //Content of the top field from the api of top anime -class TopAnime{ +class TopAnime { @SerializedName("mal_id") var mal_id: Int? = null + @SerializedName("rank") var rank: Int? = null + @SerializedName("title") var title: String? = null + @SerializedName("url") var url: String? = null + @SerializedName("episodes") var episodes: Int? = null + @SerializedName("start_date") var start_date: String? = null + @SerializedName("end_date") var end_date: String? = null + @SerializedName("score") var score: Float? = null + @SerializedName("image_url") var image_url: String? = null diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimeAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimeAdapter.kt index bda6ec5..fa1b5ed 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimeAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimeAdapter.kt @@ -13,7 +13,7 @@ import com.bumptech.glide.request.RequestOptions import xyz.adjutor.aniki.R class TopAnimeAdapter(private val animeList: List<TopAnime>) : - RecyclerView.Adapter<TopAnimeAdapter.AnimeViewHolder>() { + RecyclerView.Adapter<TopAnimeAdapter.AnimeViewHolder>() { // Describes an item view and its place within the RecyclerView class AnimeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { @@ -27,7 +27,7 @@ class TopAnimeAdapter(private val animeList: List<TopAnime>) : // Returns a new ViewHolder override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AnimeViewHolder { val view = LayoutInflater.from(parent.context) - .inflate(R.layout.item_layout, parent, false) + .inflate(R.layout.item_layout, parent, false) return AnimeViewHolder(view) } @@ -45,10 +45,10 @@ class TopAnimeAdapter(private val animeList: List<TopAnime>) : holder.animeScore.text = currentAnime.score.toString() val image: String = currentAnime.image_url.toString() Glide - .with(holder.itemView.context) - .load(image) - .apply(RequestOptions().override(400)) - .into(holder.animeImage) + .with(holder.itemView.context) + .load(image) + .apply(RequestOptions().override(400)) + .into(holder.animeImage) //when you click on a selected cardview, some datas are sent to the other activity holder.cardview.setOnClickListener { @@ -62,17 +62,18 @@ class TopAnimeAdapter(private val animeList: List<TopAnime>) : val currentAnimeEndDate = "theanimeenddate" val currentAnimeUrl = "theanimeurl" - val intent: Intent = Intent(holder.itemView.context, DetailTopAnimeActivity::class.java).apply { - putExtra(currentAnimeId, currentAnime.mal_id.toString()) - putExtra(currentAnimeTitle, currentAnime.title) - putExtra(currentAnimeRank, currentAnime.rank.toString()) - putExtra(currentAnimeScore, currentAnime.score.toString()) - putExtra(currentAnimeImageUrl, currentAnime.image_url.toString()) - putExtra(currentAnimeEpisodes, currentAnime.episodes.toString()) - putExtra(currentAnimeStartDate, currentAnime.start_date) - putExtra(currentAnimeEndDate, currentAnime.end_date.toString()) - putExtra(currentAnimeUrl, currentAnime.url.toString()) - } + val intent: Intent = + Intent(holder.itemView.context, DetailTopAnimeActivity::class.java).apply { + putExtra(currentAnimeId, currentAnime.mal_id.toString()) + putExtra(currentAnimeTitle, currentAnime.title) + putExtra(currentAnimeRank, currentAnime.rank.toString()) + putExtra(currentAnimeScore, currentAnime.score.toString()) + putExtra(currentAnimeImageUrl, currentAnime.image_url.toString()) + putExtra(currentAnimeEpisodes, currentAnime.episodes.toString()) + putExtra(currentAnimeStartDate, currentAnime.start_date) + putExtra(currentAnimeEndDate, currentAnime.end_date.toString()) + putExtra(currentAnimeUrl, currentAnime.url.toString()) + } holder.itemView.context.startActivity(intent) } } diff --git a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimePage.kt b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimePage.kt index efa45dd..ccae2fa 100644 --- a/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimePage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/anime/topanime/TopAnimePage.kt @@ -27,13 +27,13 @@ class TopAnimePage : Fragment() { var sharedPreferences: SharedPreferences? = null val gson = GsonBuilder() - .setLenient() - .create() + .setLenient() + .create() var base_url = "https://api.jikan.moe/" //the api's base url override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment val view = inflater.inflate(R.layout.top_anime_page, container, false) @@ -41,7 +41,7 @@ class TopAnimePage : Fragment() { sharedPreferences = view.context.getSharedPreferences("sp_anime", Context.MODE_PRIVATE) val animeList: List<TopAnime>? = getDataFromCache() - if(animeList != null ){ + if (animeList != null) { showList(view, animeList) } else { makeApiCall(view, base_url) @@ -55,7 +55,7 @@ class TopAnimePage : Fragment() { val jsonAnime: String? = sharedPreferences?.getString("jsonAnimeList", null) //if it's null, well, return null - if(jsonAnime == null) { + if (jsonAnime == null) { return null } else { //else deserialize the list and return it val listType: Type = object : TypeToken<List<TopAnime>>() {}.type @@ -72,12 +72,13 @@ class TopAnimePage : Fragment() { } fun updateList() { - makeApiCall(view,base_url) + makeApiCall(view, base_url) Snackbar.make(requireView(), "Data refreshed", Snackbar.LENGTH_LONG) .setAction("Action", null).show() } + val swipeRefresh: SwipeRefreshLayout = view.findViewById(R.id.swiperefresh) - swipeRefresh.setOnRefreshListener{ + swipeRefresh.setOnRefreshListener { updateList() swipeRefresh.isRefreshing = false } @@ -85,7 +86,7 @@ class TopAnimePage : Fragment() { } //display the recyclerview - fun showList(view: View, animeList: List<TopAnime> ){ + fun showList(view: View, animeList: List<TopAnime>) { val recyclerView: RecyclerView = view.findViewById(R.id.recycler_view) recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(view.context) @@ -95,20 +96,27 @@ class TopAnimePage : Fragment() { private fun makeApiCall(view: View, BASE_URL: String) { val retrofit = Retrofit.Builder() - .baseUrl(BASE_URL) - .addConverterFactory(GsonConverterFactory.create(gson)) - .build() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() val service = retrofit.create(TopAnimeApi::class.java) val call = service.getTopAnimeData() call.enqueue(object : Callback<RestTopAnimeResponse> { - override fun onResponse(call: Call<RestTopAnimeResponse>, response: Response<RestTopAnimeResponse>) { - if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty - - val animeList: List<TopAnime> = response.body()!!.getResults() //getting the "top" field containing our list of TopAnimes + override fun onResponse( + call: Call<RestTopAnimeResponse>, + response: Response<RestTopAnimeResponse> + ) { + if (response.isSuccessful && response.body() != null) { //if the code returned is >= 200 and < 300 AND the the body ain't empty + + val animeList: List<TopAnime> = response.body()!! + .getResults() //getting the "top" field containing our list of TopAnimes saveList(animeList) - showList(view, animeList) //calling the method in charge of displaying on the recyclerview + showList( + view, + animeList + ) //calling the method in charge of displaying on the recyclerview } else { showError() //a snackbar @@ -126,14 +134,14 @@ class TopAnimePage : Fragment() { val jsonString: String = gson.toJson(animeList) sharedPreferences - ?.edit() - ?.putString("jsonAnimeList", jsonString) - ?.apply() + ?.edit() + ?.putString("jsonAnimeList", jsonString) + ?.apply() } private fun showError() { Snackbar.make(requireView(), "API ERROR", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() + .setAction("Action", null).show() } }
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt b/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt index 00b0dce..10df7a5 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/RestMangaResponse.kt @@ -2,14 +2,17 @@ package xyz.adjutor.aniki.manga import com.google.gson.annotations.SerializedName -class RestMangaResponse{ //only kept the infos I didn't have and that were interesting to me. +class RestMangaResponse { //only kept the infos I didn't have and that were interesting to me. @SerializedName("mal_id") var mal_id: Int? = null + @SerializedName("chapters") var chapters: Int? = null + @SerializedName("synopsis") var synopsis: String? = null + @SerializedName("background") var background: String? = null //a bit of background story about the manga diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/DetailTopMangaActivity.kt index 0d0d4b5..c7b6317 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/DetailTopMangaActivity.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/DetailTopMangaActivity.kt @@ -26,8 +26,8 @@ class DetailTopMangaActivity : AppCompatActivity() { private var baseUrl = "https://api.jikan.moe/" var sharedPreferences: SharedPreferences? = null private val gson = GsonBuilder() - .setLenient() - .create() + .setLenient() + .create() private val intentMangaId = "themangaid" private val intentMangaTitle = "themangatitle" @@ -79,7 +79,7 @@ class DetailTopMangaActivity : AppCompatActivity() { .into(ivImage) //using null as a string because it has been converted to a string before - tvVolumes.text = if (mangaVolumes != "null"){ + tvVolumes.text = if (mangaVolumes != "null") { mangaVolumes } else { fieldIsNull() @@ -87,7 +87,7 @@ class DetailTopMangaActivity : AppCompatActivity() { tvStartDate.text = mangaStartDate - tvEndDate.text = if (mangaEndDate != "null"){ + tvEndDate.text = if (mangaEndDate != "null") { mangaEndDate } else { fieldIsNull() @@ -96,7 +96,7 @@ class DetailTopMangaActivity : AppCompatActivity() { tvUrl.text = mangaUrl val manga: RestMangaResponse? = getDataFromCache(mangaId.toString()) - if(manga != null ){ + if (manga != null) { showDetail(manga) } else { //taking the API's fields I want and displaying them @@ -106,9 +106,9 @@ class DetailTopMangaActivity : AppCompatActivity() { } private fun getDataFromCache(mangaId: String): RestMangaResponse? { - val jsonManga: String?= sharedPreferences?.getString(mangaId, null) + val jsonManga: String? = sharedPreferences?.getString(mangaId, null) - return if(jsonManga == null) { + return if (jsonManga == null) { null } else { val type: Type = object : TypeToken<RestMangaResponse>() {}.type @@ -119,16 +119,19 @@ class DetailTopMangaActivity : AppCompatActivity() { private fun makeApiCall(BASE_URL: String, mangaId: String) { val retrofit = Retrofit.Builder() - .baseUrl(BASE_URL) - .addConverterFactory(GsonConverterFactory.create(gson)) - .build() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() val service = retrofit.create(MangaApi::class.java) val call = service.getMangaData(mangaId) //based on the id call.enqueue(object : Callback<RestMangaResponse> { - override fun onResponse(call: Call<RestMangaResponse>, response: Response<RestMangaResponse>) { - if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty + override fun onResponse( + call: Call<RestMangaResponse>, + response: Response<RestMangaResponse> + ) { + if (response.isSuccessful && response.body() != null) { //if the code returned is >= 200 and < 300 AND the the body ain't empty val manga = response.body() //getting the RestMangaResponse fields saveList(manga) @@ -152,7 +155,7 @@ class DetailTopMangaActivity : AppCompatActivity() { val tvSynopsis: TextView = findViewById(R.id.tv_synopsis) val tvBackground: TextView = findViewById(R.id.tv_background) - tvChapters.text = if (manga.chapters != null){ + tvChapters.text = if (manga.chapters != null) { manga.chapters.toString() } else { fieldIsNull() @@ -160,7 +163,7 @@ class DetailTopMangaActivity : AppCompatActivity() { tvSynopsis.text = manga.synopsis.toString() - tvBackground.text = if (manga.background != null){ + tvBackground.text = if (manga.background != null) { manga.background.toString() } else { fieldIsNull() @@ -171,7 +174,8 @@ class DetailTopMangaActivity : AppCompatActivity() { fun showError(text: String) { Toast.makeText(this, text, Toast.LENGTH_LONG).show() } - private fun fieldIsNull(): String{ + + private fun fieldIsNull(): String { return "Unknown" } @@ -179,8 +183,8 @@ class DetailTopMangaActivity : AppCompatActivity() { val jsonString: String = gson.toJson(manga) sharedPreferences - ?.edit() - ?.putString(manga?.mal_id.toString(), jsonString) - ?.apply() + ?.edit() + ?.putString(manga?.mal_id.toString(), jsonString) + ?.apply() } }
\ No newline at end of file diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopManga.kt b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopManga.kt index 8d952b3..2ceceea 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopManga.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopManga.kt @@ -3,24 +3,32 @@ package xyz.adjutor.aniki.manga.topmanga import com.google.gson.annotations.SerializedName //Content of the top field from the api of top manga -class TopManga{ +class TopManga { @SerializedName("mal_id") var mal_id: Int? = null + @SerializedName("rank") var rank: Int? = null + @SerializedName("title") var title: String? = null + @SerializedName("url") var url: String? = null + @SerializedName("volumes") var volumes: Int? = null + @SerializedName("start_date") var start_date: String? = null + @SerializedName("end_date") var end_date: String? = null + @SerializedName("score") var score: Float? = null + @SerializedName("image_url") var image_url: String? = null diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaAdapter.kt b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaAdapter.kt index a259750..626f34e 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaAdapter.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaAdapter.kt @@ -13,7 +13,7 @@ import com.bumptech.glide.request.RequestOptions import xyz.adjutor.aniki.R class TopMangaAdapter(private val mangaList: List<TopManga>) : - RecyclerView.Adapter<TopMangaAdapter.MangaViewHolder>() { + RecyclerView.Adapter<TopMangaAdapter.MangaViewHolder>() { // Describes an item view and its place within the RecyclerView class MangaViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { @@ -27,7 +27,7 @@ class TopMangaAdapter(private val mangaList: List<TopManga>) : // Returns a new ViewHolder override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MangaViewHolder { val view = LayoutInflater.from(parent.context) - .inflate(R.layout.item_layout, parent, false) + .inflate(R.layout.item_layout, parent, false) return MangaViewHolder(view) } @@ -45,10 +45,10 @@ class TopMangaAdapter(private val mangaList: List<TopManga>) : holder.mangaScore.text = currentManga.score.toString() val image: String = currentManga.image_url.toString() Glide - .with(holder.itemView.context) - .load(image) - .apply(RequestOptions().override(400)) - .into(holder.mangaImage) + .with(holder.itemView.context) + .load(image) + .apply(RequestOptions().override(400)) + .into(holder.mangaImage) //when you click on a selected cardview, some datas are sent to the other activity holder.cardview.setOnClickListener { @@ -62,17 +62,18 @@ class TopMangaAdapter(private val mangaList: List<TopManga>) : val currentMangaEndDate = "themangaenddate" val currentMangaUrl = "themangaurl" - val intent: Intent = Intent(holder.itemView.context, DetailTopMangaActivity::class.java).apply { - putExtra(currentMangaId, currentManga.mal_id.toString()) - putExtra(currentMangaTitle, currentManga.title) - putExtra(currentMangaRank, currentManga.rank.toString()) - putExtra(currentMangaScore, currentManga.score.toString()) - putExtra(currentMangaImageUrl, currentManga.image_url.toString()) - putExtra(currentMangaVolumes, currentManga.volumes.toString()) - putExtra(currentMangaStartDate, currentManga.start_date) - putExtra(currentMangaEndDate, currentManga.end_date.toString()) - putExtra(currentMangaUrl, currentManga.url.toString()) - } + val intent: Intent = + Intent(holder.itemView.context, DetailTopMangaActivity::class.java).apply { + putExtra(currentMangaId, currentManga.mal_id.toString()) + putExtra(currentMangaTitle, currentManga.title) + putExtra(currentMangaRank, currentManga.rank.toString()) + putExtra(currentMangaScore, currentManga.score.toString()) + putExtra(currentMangaImageUrl, currentManga.image_url.toString()) + putExtra(currentMangaVolumes, currentManga.volumes.toString()) + putExtra(currentMangaStartDate, currentManga.start_date) + putExtra(currentMangaEndDate, currentManga.end_date.toString()) + putExtra(currentMangaUrl, currentManga.url.toString()) + } holder.itemView.context.startActivity(intent) } } diff --git a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt index d28161a..ce9b1c6 100644 --- a/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt +++ b/app/src/main/java/xyz/adjutor/aniki/manga/topmanga/TopMangaPage.kt @@ -13,6 +13,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import com.google.android.material.snackbar.Snackbar +import com.google.gson.Gson import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken import retrofit2.Call @@ -26,14 +27,14 @@ import java.lang.reflect.Type class TopMangaPage : Fragment() { var sharedPreferences: SharedPreferences? = null - val gson = GsonBuilder() - .setLenient() - .create() - var base_url = "https://api.jikan.moe/" //the api's base url + val gson: Gson = GsonBuilder() + .setLenient() + .create() + private var baseUrl = "https://api.jikan.moe/" //the api's base url override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? ): View? { // Inflate the layout for this fragment val view = inflater.inflate(R.layout.top_manga_page, container, false) @@ -41,10 +42,10 @@ class TopMangaPage : Fragment() { sharedPreferences = view.context.getSharedPreferences("sp_manga", Context.MODE_PRIVATE) val mangaList: List<TopManga>? = getDataFromCache() - if(mangaList != null ){ + if (mangaList != null) { showList(view, mangaList) } else { - makeApiCall(view, base_url) + makeApiCall(view, baseUrl) } return view @@ -55,11 +56,11 @@ class TopMangaPage : Fragment() { val jsonManga: String? = sharedPreferences?.getString("jsonMangaList", null) //if it's null, well, return null - if(jsonManga == null) { - return null + return if (jsonManga == null) { + null } else { //else deserialize the list and return it val listType: Type = object : TypeToken<List<TopManga>>() {}.type - return gson.fromJson(jsonManga, listType) + gson.fromJson(jsonManga, listType) } } @@ -72,12 +73,13 @@ class TopMangaPage : Fragment() { } fun updateList() { - makeApiCall(view,base_url) + makeApiCall(view, baseUrl) Snackbar.make(requireView(), "Data refreshed", Snackbar.LENGTH_LONG) .setAction("Action", null).show() } + val swipeRefresh: SwipeRefreshLayout = view.findViewById(R.id.swiperefresh) - swipeRefresh.setOnRefreshListener{ + swipeRefresh.setOnRefreshListener { updateList() swipeRefresh.isRefreshing = false } @@ -85,7 +87,7 @@ class TopMangaPage : Fragment() { } //display the recyclerview - fun showList(view: View, mangaList: List<TopManga> ){ + fun showList(view: View, mangaList: List<TopManga>) { val recyclerView: RecyclerView = view.findViewById(R.id.recycler_view) recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(view.context) @@ -95,20 +97,27 @@ class TopMangaPage : Fragment() { private fun makeApiCall(view: View, BASE_URL: String) { val retrofit = Retrofit.Builder() - .baseUrl(BASE_URL) - .addConverterFactory(GsonConverterFactory.create(gson)) - .build() + .baseUrl(BASE_URL) + .addConverterFactory(GsonConverterFactory.create(gson)) + .build() val service = retrofit.create(TopMangaApi::class.java) val call = service.getTopMangaData() call.enqueue(object : Callback<RestTopMangaResponse> { - override fun onResponse(call: Call<RestTopMangaResponse>, response: Response<RestTopMangaResponse>) { - if(response.isSuccessful && response.body() != null){ //if the code returned is >= 200 and < 300 AND the the body ain't empty - - val mangaList: List<TopManga> = response.body()!!.getResults() //getting the "top" field containing our list of TopMangas + override fun onResponse( + call: Call<RestTopMangaResponse>, + response: Response<RestTopMangaResponse> + ) { + if (response.isSuccessful && response.body() != null) { //if the code returned is >= 200 and < 300 AND the the body ain't empty + + val mangaList: List<TopManga> = response.body()!! + .getResults() //getting the "top" field containing our list of TopMangas saveList(mangaList) - showList(view, mangaList) //calling the method in charge of displaying on the recyclerview + showList( + view, + mangaList + ) //calling the method in charge of displaying on the recyclerview } else { showError() //a snackbar @@ -126,14 +135,14 @@ class TopMangaPage : Fragment() { val jsonString: String = gson.toJson(mangaList) sharedPreferences - ?.edit() - ?.putString("jsonMangaList", jsonString) - ?.apply() + ?.edit() + ?.putString("jsonMangaList", jsonString) + ?.apply() } private fun showError() { Snackbar.make(requireView(), "API ERROR", Snackbar.LENGTH_LONG) - .setAction("Action", null).show() + .setAction("Action", null).show() } }
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_detail_top_anime.xml b/app/src/main/res/layout/activity_detail_top_anime.xml index 15de318..cd7bb59 100644 --- a/app/src/main/res/layout/activity_detail_top_anime.xml +++ b/app/src/main/res/layout/activity_detail_top_anime.xml @@ -3,251 +3,258 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/very_dark_purple"> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:context=".anime.topanime.DetailTopAnimeActivity"> - <androidx.cardview.widget.CardView - android:id="@+id/cv_header" + + <androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toTopOf="parent"> - <androidx.constraintlayout.widget.ConstraintLayout + tools:context=".anime.topanime.DetailTopAnimeActivity"> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_header" android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toTopOf="parent"> - <TextView - android:layout_width="wrap_content" + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/text_mal_id" - android:textColor="@color/strong_pink" - app:layout_constraintEnd_toStartOf="@id/tv_detail_id" /> - <TextView - android:id="@+id/tv_detail_id" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/id" - android:textColor="@color/slightly_desaturated_magenta" - android:textIsSelectable="true" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@id/iv_detail_image" - app:layout_constraintTop_toTopOf="parent" /> - - <ImageView - android:id="@+id/iv_detail_image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:contentDescription="@string/image" - android:src="@mipmap/ic_launcher" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_detail_title" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_marginHorizontal="10sp" - android:fontFamily="@font/bangers" - android:text="@string/title" - android:textAlignment="center" - android:textColor="@color/strong_pink" - android:textIsSelectable="true" - android:textSize="30sp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@id/iv_detail_image" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_rank" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_detail_rank" - app:layout_constraintEnd_toStartOf="@id/tv_detail_rank" - app:layout_constraintTop_toTopOf="@id/tv_detail_rank" /> - <TextView - android:id="@+id/tv_detail_rank" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/rank" - android:textColor="@color/slightly_desaturated_magenta" - android:textSize="20sp" - app:layout_constraintBottom_toTopOf="@id/tv_detail_title" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_score" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_detail_score" - app:layout_constraintEnd_toStartOf="@id/tv_detail_score" - app:layout_constraintTop_toTopOf="@id/tv_detail_score" /> - <TextView - android:id="@+id/tv_detail_score" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/score" - android:textColor="@color/slightly_desaturated_magenta" - android:textSize="20sp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_detail_title" /> - - </androidx.constraintlayout.widget.ConstraintLayout> -</androidx.cardview.widget.CardView> - - <androidx.cardview.widget.CardView - android:id="@+id/cv_more_infos" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_header"> + android:padding="10dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="@string/text_mal_id" + android:textColor="@color/strong_pink" + app:layout_constraintEnd_toStartOf="@id/tv_detail_id" /> + + <TextView + android:id="@+id/tv_detail_id" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/id" + android:textColor="@color/slightly_desaturated_magenta" + android:textIsSelectable="true" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/iv_detail_image" + app:layout_constraintTop_toTopOf="parent" /> - <androidx.constraintlayout.widget.ConstraintLayout + <ImageView + android:id="@+id/iv_detail_image" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="@string/image" + android:src="@mipmap/ic_launcher" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_detail_title" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_marginHorizontal="10sp" + android:fontFamily="@font/bangers" + android:text="@string/title" + android:textAlignment="center" + android:textColor="@color/strong_pink" + android:textIsSelectable="true" + android:textSize="30sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/iv_detail_image" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_rank" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_detail_rank" + app:layout_constraintEnd_toStartOf="@id/tv_detail_rank" + app:layout_constraintTop_toTopOf="@id/tv_detail_rank" /> + + <TextView + android:id="@+id/tv_detail_rank" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/rank" + android:textColor="@color/slightly_desaturated_magenta" + android:textSize="20sp" + app:layout_constraintBottom_toTopOf="@id/tv_detail_title" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_score" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_detail_score" + app:layout_constraintEnd_toStartOf="@id/tv_detail_score" + app:layout_constraintTop_toTopOf="@id/tv_detail_score" /> + + <TextView + android:id="@+id/tv_detail_score" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/score" + android:textColor="@color/slightly_desaturated_magenta" + android:textSize="20sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_detail_title" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_more_infos" android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - <TextView - android:id="@+id/tv_text_episodes" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_episodes" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_episodes" - app:layout_constraintEnd_toStartOf="@id/tv_episodes" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/tv_episodes" /> - - <TextView - android:id="@+id/tv_episodes" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/episodes" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintStart_toEndOf="@id/tv_text_episodes" - app:layout_constraintTop_toTopOf="parent" - app:layout_constraintBottom_toBottomOf="parent"/> - - <TextView - android:id="@+id/tv_text_start_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_start_date" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_start_date" - app:layout_constraintEnd_toStartOf="@id/tv_start_date" - app:layout_constraintTop_toTopOf="@id/tv_start_date" /> - - <TextView - android:id="@+id/tv_start_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/start_date" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_text_end_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_end_date" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_end_date" - app:layout_constraintEnd_toStartOf="@id/tv_end_date" - app:layout_constraintTop_toTopOf="@id/tv_end_date" /> - - <TextView - android:id="@+id/tv_end_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/end_date" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_start_date" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> - - <androidx.cardview.widget.CardView - android:id="@+id/cv_synopsis" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_more_infos"> - <androidx.constraintlayout.widget.ConstraintLayout + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_header"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + + <TextView + android:id="@+id/tv_text_episodes" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_episodes" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_episodes" + app:layout_constraintEnd_toStartOf="@id/tv_episodes" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@id/tv_episodes" /> + + <TextView + android:id="@+id/tv_episodes" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/episodes" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/tv_text_episodes" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_text_start_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_start_date" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_start_date" + app:layout_constraintEnd_toStartOf="@id/tv_start_date" + app:layout_constraintTop_toTopOf="@id/tv_start_date" /> + + <TextView + android:id="@+id/tv_start_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/start_date" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_text_end_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_end_date" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_end_date" + app:layout_constraintEnd_toStartOf="@id/tv_end_date" + app:layout_constraintTop_toTopOf="@id/tv_end_date" /> + + <TextView + android:id="@+id/tv_end_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/end_date" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_start_date" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_synopsis" android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - <TextView - android:id="@+id/tv_text_synopsis" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_synopsis" - android:textColor="@color/strong_pink" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - <TextView - android:id="@+id/tv_synopsis" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/synopsis" - android:textColor="@color/slightly_desaturated_magenta" - android:textIsSelectable="true" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis" - /> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_more_infos"> - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> - <androidx.cardview.widget.CardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_synopsis"> - <androidx.constraintlayout.widget.ConstraintLayout + <TextView + android:id="@+id/tv_text_synopsis" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_synopsis" + android:textColor="@color/strong_pink" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_synopsis" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/synopsis" + android:textColor="@color/slightly_desaturated_magenta" + android:textIsSelectable="true" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - - <TextView - android:id="@+id/tv_text_url" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_url" - android:textColor="@color/strong_pink" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_url" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/url" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_text_url" - android:autoLink="all" - android:textColorLink="@color/very_light_magenta" - /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> - -</androidx.constraintlayout.widget.ConstraintLayout> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_synopsis"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + + + <TextView + android:id="@+id/tv_text_url" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_url" + android:textColor="@color/strong_pink" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_url" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:autoLink="all" + android:text="@string/url" + android:textColor="@color/slightly_desaturated_magenta" + android:textColorLink="@color/very_light_magenta" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_text_url" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + </androidx.constraintlayout.widget.ConstraintLayout> </ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_detail_top_manga.xml b/app/src/main/res/layout/activity_detail_top_manga.xml index 0a8f07b..3f703b6 100644 --- a/app/src/main/res/layout/activity_detail_top_manga.xml +++ b/app/src/main/res/layout/activity_detail_top_manga.xml @@ -3,305 +3,313 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/very_dark_purple"> -<androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="match_parent" - android:layout_height="wrap_content" - tools:context=".manga.topmanga.DetailTopMangaActivity"> - <androidx.cardview.widget.CardView - android:id="@+id/cv_header" + + <androidx.constraintlayout.widget.ConstraintLayout xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toTopOf="parent"> - <androidx.constraintlayout.widget.ConstraintLayout + tools:context=".manga.topmanga.DetailTopMangaActivity"> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_header" android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toTopOf="parent"> - <TextView - android:layout_width="wrap_content" + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" android:layout_height="match_parent" - android:text="@string/text_mal_id" - android:textColor="@color/strong_pink" - app:layout_constraintEnd_toStartOf="@id/tv_detail_id" /> - <TextView - android:id="@+id/tv_detail_id" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/id" - android:textColor="@color/slightly_desaturated_magenta" - android:textIsSelectable="true" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@id/iv_detail_image" - app:layout_constraintTop_toTopOf="parent" /> - - <ImageView - android:id="@+id/iv_detail_image" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:contentDescription="@string/image" - android:src="@mipmap/ic_launcher" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_detail_title" - android:layout_width="0dp" - android:layout_height="match_parent" - android:layout_marginHorizontal="10sp" - android:fontFamily="@font/bangers" - android:text="@string/title" - android:textAlignment="center" - android:textColor="@color/strong_pink" - android:textIsSelectable="true" - android:textSize="30sp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@id/iv_detail_image" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_rank" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_detail_rank" - app:layout_constraintEnd_toStartOf="@id/tv_detail_rank" - app:layout_constraintTop_toTopOf="@id/tv_detail_rank" /> - <TextView - android:id="@+id/tv_detail_rank" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/rank" - android:textColor="@color/slightly_desaturated_magenta" - android:textSize="20sp" - app:layout_constraintBottom_toTopOf="@id/tv_detail_title" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_score" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_detail_score" - app:layout_constraintEnd_toStartOf="@id/tv_detail_score" - app:layout_constraintTop_toTopOf="@id/tv_detail_score" /> - <TextView - android:id="@+id/tv_detail_score" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/score" - android:textColor="@color/slightly_desaturated_magenta" - android:textSize="20sp" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_detail_title" /> - - </androidx.constraintlayout.widget.ConstraintLayout> -</androidx.cardview.widget.CardView> - - <androidx.cardview.widget.CardView - android:id="@+id/cv_more_infos" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_header"> + android:padding="10dp"> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - <TextView - android:id="@+id/tv_text_volumes" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_volumes" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_volumes" - app:layout_constraintEnd_toStartOf="@id/tv_volumes" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="@id/tv_volumes" /> - - <TextView - android:id="@+id/tv_volumes" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/volumes" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintStart_toEndOf="@id/tv_text_volumes" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_text_chapters" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_chapters" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_chapters" - app:layout_constraintEnd_toStartOf="@id/tv_chapters" - app:layout_constraintTop_toTopOf="@id/tv_chapters" /> - - <TextView - android:id="@+id/tv_chapters" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/chapters" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/tv_text_chapters" - app:layout_constraintTop_toBottomOf="@id/tv_volumes" /> - - <TextView - android:id="@+id/tv_text_start_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_start_date" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_start_date" - app:layout_constraintEnd_toStartOf="@id/tv_start_date" - app:layout_constraintTop_toTopOf="@id/tv_start_date" /> - - <TextView - android:id="@+id/tv_start_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/start_date" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_text_end_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_end_date" - android:textColor="@color/strong_pink" - app:layout_constraintBottom_toBottomOf="@id/tv_end_date" - app:layout_constraintEnd_toStartOf="@id/tv_end_date" - app:layout_constraintTop_toTopOf="@id/tv_end_date" /> - - <TextView - android:id="@+id/tv_end_date" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/end_date" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_start_date" /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> - - <androidx.cardview.widget.CardView - android:id="@+id/cv_synopsis" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_more_infos"> - <androidx.constraintlayout.widget.ConstraintLayout + <TextView + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:text="@string/text_mal_id" + android:textColor="@color/strong_pink" + app:layout_constraintEnd_toStartOf="@id/tv_detail_id" /> + + <TextView + android:id="@+id/tv_detail_id" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/id" + android:textColor="@color/slightly_desaturated_magenta" + android:textIsSelectable="true" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/iv_detail_image" + app:layout_constraintTop_toTopOf="parent" /> + + <ImageView + android:id="@+id/iv_detail_image" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="@string/image" + android:src="@mipmap/ic_launcher" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_detail_title" + android:layout_width="0dp" + android:layout_height="match_parent" + android:layout_marginHorizontal="10sp" + android:fontFamily="@font/bangers" + android:text="@string/title" + android:textAlignment="center" + android:textColor="@color/strong_pink" + android:textIsSelectable="true" + android:textSize="30sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@id/iv_detail_image" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_rank" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_detail_rank" + app:layout_constraintEnd_toStartOf="@id/tv_detail_rank" + app:layout_constraintTop_toTopOf="@id/tv_detail_rank" /> + + <TextView + android:id="@+id/tv_detail_rank" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/rank" + android:textColor="@color/slightly_desaturated_magenta" + android:textSize="20sp" + app:layout_constraintBottom_toTopOf="@id/tv_detail_title" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_score" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_detail_score" + app:layout_constraintEnd_toStartOf="@id/tv_detail_score" + app:layout_constraintTop_toTopOf="@id/tv_detail_score" /> + + <TextView + android:id="@+id/tv_detail_score" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/score" + android:textColor="@color/slightly_desaturated_magenta" + android:textSize="20sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_detail_title" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_more_infos" android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - <TextView - android:id="@+id/tv_text_synopsis" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_synopsis" - android:textColor="@color/strong_pink" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - <TextView - android:id="@+id/tv_synopsis" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/synopsis" - android:textColor="@color/slightly_desaturated_magenta" - android:textIsSelectable="true" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis" - /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> - - <androidx.cardview.widget.CardView - android:id="@+id/cv_background" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_synopsis"> - <androidx.constraintlayout.widget.ConstraintLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_header"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + + <TextView + android:id="@+id/tv_text_volumes" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_volumes" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_volumes" + app:layout_constraintEnd_toStartOf="@id/tv_volumes" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="@id/tv_volumes" /> + + <TextView + android:id="@+id/tv_volumes" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/volumes" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintStart_toEndOf="@id/tv_text_volumes" + app:layout_constraintTop_toTopOf="parent" /> + <TextView + android:id="@+id/tv_text_chapters" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_chapters" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_chapters" + app:layout_constraintEnd_toStartOf="@id/tv_chapters" + app:layout_constraintTop_toTopOf="@id/tv_chapters" /> - <TextView - android:id="@+id/tv_text_background" - android:layout_width="wrap_content" + <TextView + android:id="@+id/tv_chapters" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/chapters" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toEndOf="@id/tv_text_chapters" + app:layout_constraintTop_toBottomOf="@id/tv_volumes" /> + + <TextView + android:id="@+id/tv_text_start_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_start_date" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_start_date" + app:layout_constraintEnd_toStartOf="@id/tv_start_date" + app:layout_constraintTop_toTopOf="@id/tv_start_date" /> + + <TextView + android:id="@+id/tv_start_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/start_date" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_text_end_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_end_date" + android:textColor="@color/strong_pink" + app:layout_constraintBottom_toBottomOf="@id/tv_end_date" + app:layout_constraintEnd_toStartOf="@id/tv_end_date" + app:layout_constraintTop_toTopOf="@id/tv_end_date" /> + + <TextView + android:id="@+id/tv_end_date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/end_date" + android:textColor="@color/slightly_desaturated_magenta" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_start_date" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_synopsis" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/text_background" - android:textColor="@color/strong_pink" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_background" - android:layout_width="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_more_infos"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + + <TextView + android:id="@+id/tv_text_synopsis" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_synopsis" + android:textColor="@color/strong_pink" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_synopsis" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/synopsis" + android:textColor="@color/slightly_desaturated_magenta" + android:textIsSelectable="true" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_text_synopsis" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView + android:id="@+id/cv_background" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/background" - android:textColor="@color/slightly_desaturated_magenta" - android:textIsSelectable="true" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_text_background" /> + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_synopsis"> - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> - <androidx.cardview.widget.CardView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="4sp" - app:cardBackgroundColor="@color/black" - app:layout_constraintTop_toBottomOf="@id/cv_background"> - <androidx.constraintlayout.widget.ConstraintLayout + + <TextView + android:id="@+id/tv_text_background" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_background" + android:textColor="@color/strong_pink" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_background" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/background" + android:textColor="@color/slightly_desaturated_magenta" + android:textIsSelectable="true" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_text_background" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + <androidx.cardview.widget.CardView android:layout_width="match_parent" - android:layout_height="match_parent" - android:padding="10dp"> - - - <TextView - android:id="@+id/tv_text_url" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/text_url" - android:textColor="@color/strong_pink" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> - - <TextView - android:id="@+id/tv_url" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/url" - android:textColor="@color/slightly_desaturated_magenta" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_text_url" - android:autoLink="all" - android:textColorLink="@color/very_light_magenta" - /> - - </androidx.constraintlayout.widget.ConstraintLayout> - </androidx.cardview.widget.CardView> - -</androidx.constraintlayout.widget.ConstraintLayout> + android:layout_height="wrap_content" + android:layout_margin="4sp" + app:cardBackgroundColor="@color/black" + app:layout_constraintTop_toBottomOf="@id/cv_background"> + + <androidx.constraintlayout.widget.ConstraintLayout + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="10dp"> + + + <TextView + android:id="@+id/tv_text_url" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/text_url" + android:textColor="@color/strong_pink" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/tv_url" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:autoLink="all" + android:text="@string/url" + android:textColor="@color/slightly_desaturated_magenta" + android:textColorLink="@color/very_light_magenta" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_text_url" /> + + </androidx.constraintlayout.widget.ConstraintLayout> + </androidx.cardview.widget.CardView> + + </androidx.constraintlayout.widget.ConstraintLayout> </ScrollView>
\ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index dd69e51..a975f22 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.coordinatorlayout.widget.CoordinatorLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.coordinatorlayout.widget.CoordinatorLayout 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" diff --git a/app/src/main/res/layout/home_page.xml b/app/src/main/res/layout/home_page.xml index 564d7da..6456dfc 100644 --- a/app/src/main/res/layout/home_page.xml +++ b/app/src/main/res/layout/home_page.xml @@ -4,9 +4,8 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - tools:context=".HomePage" android:background="@color/very_dark_purple" - > + tools:context=".HomePage"> <TextView android:id="@+id/tv_title" @@ -19,29 +18,26 @@ android:textColor="@color/strong_pink" android:textSize="40sp" app:layout_constraintBottom_toBottomOf="@id/button_top_manga" - app:layout_constraintTop_toTopOf="parent" - /> + app:layout_constraintTop_toTopOf="parent" /> <Button android:id="@+id/button_top_manga" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/top_manga" - app:layout_constraintTop_toBottomOf="@id/tv_title" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toStartOf="parent" app:layout_constraintEnd_toStartOf="@id/button_top_anime" - /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/tv_title" /> <Button android:id="@+id/button_top_anime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/top_anime" - app:layout_constraintTop_toBottomOf="@id/tv_title" app:layout_constraintBottom_toBottomOf="parent" - app:layout_constraintStart_toEndOf="@id/button_top_manga" app:layout_constraintEnd_toEndOf="parent" - /> + app:layout_constraintStart_toEndOf="@id/button_top_manga" + app:layout_constraintTop_toBottomOf="@id/tv_title" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/top_anime_page.xml b/app/src/main/res/layout/top_anime_page.xml index 4f86dc7..c7ec862 100644 --- a/app/src/main/res/layout/top_anime_page.xml +++ b/app/src/main/res/layout/top_anime_page.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<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=".anime.topanime.TopAnimePage" - android:background="@color/very_dark_purple"> + android:background="@color/very_dark_purple" + tools:context=".anime.topanime.TopAnimePage"> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_constraintBottom_toTopOf="@+id/button_home" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - tools:listitem="@layout/item_layout" - android:scrollbars="vertical" /> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view" + android:layout_width="0dp" + android:layout_height="0dp" + android:scrollbars="vertical" + app:layout_constraintBottom_toTopOf="@+id/button_home" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:listitem="@layout/item_layout" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> <Button @@ -31,7 +31,6 @@ android:text="@string/home" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - /> + app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/app/src/main/res/layout/top_manga_page.xml b/app/src/main/res/layout/top_manga_page.xml index ce793af..f3d0db3 100644 --- a/app/src/main/res/layout/top_manga_page.xml +++ b/app/src/main/res/layout/top_manga_page.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="utf-8"?> -<androidx.constraintlayout.widget.ConstraintLayout - xmlns:android="http://schemas.android.com/apk/res/android" +<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=".manga.topmanga.TopMangaPage" - android:background="@color/very_dark_purple"> + android:background="@color/very_dark_purple" + tools:context=".manga.topmanga.TopMangaPage"> <androidx.swiperefreshlayout.widget.SwipeRefreshLayout android:id="@+id/swiperefresh" android:layout_width="match_parent" android:layout_height="match_parent"> - <androidx.recyclerview.widget.RecyclerView - android:id="@+id/recycler_view" - android:layout_width="0dp" - android:layout_height="0dp" - app:layout_constraintBottom_toTopOf="@+id/button_home" - app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - tools:listitem="@layout/item_layout" - android:scrollbars="vertical"/> + + <androidx.recyclerview.widget.RecyclerView + android:id="@+id/recycler_view" + android:layout_width="0dp" + android:layout_height="0dp" + android:scrollbars="vertical" + app:layout_constraintBottom_toTopOf="@+id/button_home" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" + tools:listitem="@layout/item_layout" /> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout> <Button @@ -31,7 +31,6 @@ android:text="@string/home" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toStartOf="parent" - /> + app:layout_constraintStart_toStartOf="parent" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file |