Merge branch 'dev' of https://github.com/rebelonion/Dantotsu into dev
This commit is contained in:
commit
ca0162fb9c
2 changed files with 59 additions and 22 deletions
|
@ -1,5 +1,6 @@
|
||||||
package ani.dantotsu.media
|
package ani.dantotsu.media
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
@ -19,6 +20,7 @@ import ani.dantotsu.databinding.ActivityCharacterBinding
|
||||||
import ani.dantotsu.initActivity
|
import ani.dantotsu.initActivity
|
||||||
import ani.dantotsu.loadImage
|
import ani.dantotsu.loadImage
|
||||||
import ani.dantotsu.navBarHeight
|
import ani.dantotsu.navBarHeight
|
||||||
|
import ani.dantotsu.openLinkInBrowser
|
||||||
import ani.dantotsu.others.ImageViewDialog
|
import ani.dantotsu.others.ImageViewDialog
|
||||||
import ani.dantotsu.others.getSerialized
|
import ani.dantotsu.others.getSerialized
|
||||||
import ani.dantotsu.px
|
import ani.dantotsu.px
|
||||||
|
@ -75,7 +77,17 @@ class CharacterDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChang
|
||||||
character.image
|
character.image
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
val link = "https://anilist.co/character/${character.id}"
|
||||||
|
binding.characterShare.setOnClickListener {
|
||||||
|
val i = Intent(Intent.ACTION_SEND)
|
||||||
|
i.type = "text/plain"
|
||||||
|
i.putExtra(Intent.EXTRA_TEXT, link)
|
||||||
|
startActivity(Intent.createChooser(i, character.name))
|
||||||
|
}
|
||||||
|
binding.characterShare.setOnLongClickListener {
|
||||||
|
openLinkInBrowser(link)
|
||||||
|
true
|
||||||
|
}
|
||||||
model.getCharacter().observe(this) {
|
model.getCharacter().observe(this) {
|
||||||
if (it != null && !loaded) {
|
if (it != null && !loaded) {
|
||||||
character = it
|
character = it
|
||||||
|
@ -139,13 +151,11 @@ class CharacterDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChang
|
||||||
isCollapsed = true
|
isCollapsed = true
|
||||||
if (immersiveMode) this.window.statusBarColor =
|
if (immersiveMode) this.window.statusBarColor =
|
||||||
ContextCompat.getColor(this, R.color.nav_bg)
|
ContextCompat.getColor(this, R.color.nav_bg)
|
||||||
binding.characterAppBar.setBackgroundResource(R.color.nav_bg)
|
|
||||||
}
|
}
|
||||||
if (percentage <= percent && isCollapsed) {
|
if (percentage <= percent && isCollapsed) {
|
||||||
isCollapsed = false
|
isCollapsed = false
|
||||||
if (immersiveMode) this.window.statusBarColor =
|
if (immersiveMode) this.window.statusBarColor =
|
||||||
ContextCompat.getColor(this, R.color.transparent)
|
ContextCompat.getColor(this, R.color.transparent)
|
||||||
binding.characterAppBar.setBackgroundResource(R.color.bg)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,25 +46,52 @@
|
||||||
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/characterTitle"
|
android:id="@+id/characterAccessContainer"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:orientation="horizontal">
|
||||||
android:layout_marginStart="64dp"
|
|
||||||
android:layout_marginEnd="64dp"
|
|
||||||
android:ellipsize="marquee"
|
<TextView
|
||||||
android:focusable="true"
|
android:id="@+id/characterTitle"
|
||||||
android:focusableInTouchMode="true"
|
android:layout_width="0dp"
|
||||||
android:fontFamily="@font/poppins_bold"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center_vertical"
|
android:layout_weight="1"
|
||||||
android:marqueeRepeatLimit="marquee_forever"
|
|
||||||
android:minHeight="60dp"
|
android:ellipsize="marquee"
|
||||||
android:scrollHorizontally="true"
|
android:focusable="true"
|
||||||
android:singleLine="true"
|
android:layout_marginStart="24dp"
|
||||||
android:text="@string/slogan"
|
android:focusableInTouchMode="true"
|
||||||
android:textSize="16sp"
|
android:fontFamily="@font/poppins_bold"
|
||||||
android:transitionName="characterTitle" />
|
android:gravity="center_vertical"
|
||||||
|
android:marqueeRepeatLimit="marquee_forever"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:text="@string/slogan"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:transitionName="characterTitle" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/characterFav"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
android:tintMode="src_atop"
|
||||||
|
app:srcCompat="@drawable/ic_round_favorite_border_24"
|
||||||
|
app:tint="@color/bg_opp"
|
||||||
|
tools:ignore="ContentDescription,ImageContrastCheck" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/characterShare"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="48dp"
|
||||||
|
android:padding="8dp"
|
||||||
|
app:srcCompat="@drawable/ic_round_share_24"
|
||||||
|
app:tint="@color/bg_opp"
|
||||||
|
app:tintMode="src_atop"
|
||||||
|
tools:ignore="ContentDescription,ImageContrastCheck" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
@ -120,7 +147,7 @@
|
||||||
android:translationZ="4dp"
|
android:translationZ="4dp"
|
||||||
app:cardCornerRadius="16dp"
|
app:cardCornerRadius="16dp"
|
||||||
app:cardElevation="16dp"
|
app:cardElevation="16dp"
|
||||||
app:layout_anchor="@id/characterTitle"
|
app:layout_anchor="@id/characterAccessContainer"
|
||||||
app:layout_anchorGravity="center_horizontal">
|
app:layout_anchorGravity="center_horizontal">
|
||||||
|
|
||||||
<com.google.android.material.imageview.ShapeableImageView
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue