aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-02-22 15:09:55 +0100
committerClyhtsuriva <aimeric@adjutor.xyz>2021-02-22 15:09:55 +0100
commit5e3f808975f32b5c3e2bd1fdf2fbe57de094b0b6 (patch)
tree52e5940f60b867538c8400e245277b211101fb70 /app/src
parent9ee5918fa86da6c160145498b1a95f4f4a083fdc (diff)
Scrollview added.
Some mangas had too long background ans synopsis to fit. Scrollview resolve the issue.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt13
-rw-r--r--app/src/main/res/layout/activity_detail_top_manga.xml15
2 files changed, 15 insertions, 13 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt
index 32e3457..5950352 100644
--- a/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt
+++ b/app/src/main/java/xyz/adjutor/aniki/topmanga/DetailTopMangaActivity.kt
@@ -49,7 +49,7 @@ class DetailTopMangaActivity : AppCompatActivity() {
val mangaTitle = intent.getStringExtra(intentMangaTitle)
val mangaRank = intent.getStringExtra(intentMangaRank)
val mangaScore = intent.getStringExtra(intentMangaScore)
- val mangaImage = intent.getStringExtra(intentMangaImageUrl)
+ val mangaImageUrl = intent.getStringExtra(intentMangaImageUrl)
val mangaVolumes = intent.getStringExtra(intentMangaVolumes)
val mangaStartDate = intent.getStringExtra(intentMangaStartDate)
@@ -71,7 +71,7 @@ class DetailTopMangaActivity : AppCompatActivity() {
tvScore.text = mangaScore
Glide
.with(this)
- .load(mangaImage)
+ .load(mangaImageUrl)
.apply(RequestOptions().override(400))
.into(ivImage)
@@ -98,17 +98,16 @@ class DetailTopMangaActivity : AppCompatActivity() {
makeApiCall(baseUrl, mangaId.toString())
}
-
}
private fun getDataFromCache(mangaId: String): RestMangaResponse? {
val jsonManga: String?= sharedPreferences?.getString(mangaId, null)
- if(jsonManga == null) {
- return null
+ return if(jsonManga == null) {
+ null
} else {
val type: Type = object : TypeToken<RestMangaResponse>() {}.type
- return gson.fromJson(jsonManga, type)
+ gson.fromJson(jsonManga, type)
}
}
@@ -167,7 +166,7 @@ class DetailTopMangaActivity : AppCompatActivity() {
fun showError(text: String) {
Toast.makeText(this, text, Toast.LENGTH_LONG).show()
}
- fun fieldIsNull(): String{
+ private fun fieldIsNull(): String{
return "Unknown"
}
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 f5ce8b9..655b687 100644
--- a/app/src/main/res/layout/activity_detail_top_manga.xml
+++ b/app/src/main/res/layout/activity_detail_top_manga.xml
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
+<ScrollView android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ 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="match_parent"
+ android:layout_height="wrap_content"
tools:context=".topmanga.DetailTopMangaActivity"
- android:background="@color/very_dark_purple">
+ >
<androidx.cardview.widget.CardView
android:id="@+id/cv_header"
android:layout_width="match_parent"
@@ -53,7 +56,7 @@
android:text="@string/title"
android:textAlignment="center"
android:textColor="@color/strong_pink"
- android:textSize="40sp"
+ android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/iv_detail_image"
@@ -262,5 +265,5 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
-
</androidx.constraintlayout.widget.ConstraintLayout>
+</ScrollView> \ No newline at end of file