chore: addressing SetTextI18n
This commit is contained in:
parent
bbaae2e776
commit
125a95285d
38 changed files with 246 additions and 155 deletions
|
@ -151,7 +151,10 @@ class App : MultiDexApplication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private var instance: App? = null
|
/** Reference to the application context.
|
||||||
|
*
|
||||||
|
* USE WITH EXTREME CAUTION!**/
|
||||||
|
var instance: App? = null
|
||||||
var context: Context? = null
|
var context: Context? = null
|
||||||
fun currentContext(): Context? {
|
fun currentContext(): Context? {
|
||||||
return instance?.mFTActivityLifecycleCallbacks?.currentActivity ?: context
|
return instance?.mFTActivityLifecycleCallbacks?.currentActivity ?: context
|
||||||
|
|
|
@ -401,7 +401,6 @@ class InputFilterMinMax(
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
private fun isInRange(a: Double, b: Double, c: Double): Boolean {
|
private fun isInRange(a: Double, b: Double, c: Double): Boolean {
|
||||||
val statusStrings = currContext()!!.resources.getStringArray(R.array.status_manga)[2]
|
val statusStrings = currContext()!!.resources.getStringArray(R.array.status_manga)[2]
|
||||||
|
|
||||||
|
@ -904,9 +903,9 @@ fun copyToClipboard(string: String, toast: Boolean = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun countDown(media: Media, view: ViewGroup) {
|
fun countDown(media: Media, view: ViewGroup) {
|
||||||
if (media.anime?.nextAiringEpisode != null && media.anime.nextAiringEpisodeTime != null && (media.anime.nextAiringEpisodeTime!! - System.currentTimeMillis() / 1000) <= 86400 * 28.toLong()) {
|
if (media.anime?.nextAiringEpisode != null && media.anime.nextAiringEpisodeTime != null
|
||||||
|
&& (media.anime.nextAiringEpisodeTime!! - System.currentTimeMillis() / 1000) <= 86400 * 28.toLong()) {
|
||||||
val v = ItemCountDownBinding.inflate(LayoutInflater.from(view.context), view, false)
|
val v = ItemCountDownBinding.inflate(LayoutInflater.from(view.context), view, false)
|
||||||
view.addView(v.root, 0)
|
view.addView(v.root, 0)
|
||||||
v.mediaCountdownText.text =
|
v.mediaCountdownText.text =
|
||||||
|
@ -1007,6 +1006,10 @@ class EmptyAdapter(private val count: Int) : RecyclerView.Adapter<RecyclerView.V
|
||||||
inner class EmptyViewHolder(view: View) : RecyclerView.ViewHolder(view)
|
inner class EmptyViewHolder(view: View) : RecyclerView.ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getAppString(res: Int): String {
|
||||||
|
return App.instance?.getString(res) ?: ""
|
||||||
|
}
|
||||||
|
|
||||||
fun toast(string: String?) {
|
fun toast(string: String?) {
|
||||||
if (string != null) {
|
if (string != null) {
|
||||||
Logger.log(string)
|
Logger.log(string)
|
||||||
|
@ -1017,6 +1020,10 @@ fun toast(string: String?) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun toast(res: Int) {
|
||||||
|
toast(getAppString(res))
|
||||||
|
}
|
||||||
|
|
||||||
fun snackString(s: String?, activity: Activity? = null, clipboard: String? = null): Snackbar? {
|
fun snackString(s: String?, activity: Activity? = null, clipboard: String? = null): Snackbar? {
|
||||||
try { //I have no idea why this sometimes crashes for some people...
|
try { //I have no idea why this sometimes crashes for some people...
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
|
@ -1057,6 +1064,10 @@ fun snackString(s: String?, activity: Activity? = null, clipboard: String? = nul
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun snackString(r: Int, activity: Activity? = null, clipboard: String? = null): Snackbar? {
|
||||||
|
return snackString(getAppString(r), activity, clipboard)
|
||||||
|
}
|
||||||
|
|
||||||
open class NoPaddingArrayAdapter<T>(context: Context, layoutId: Int, items: List<T>) :
|
open class NoPaddingArrayAdapter<T>(context: Context, layoutId: Int, items: List<T>) :
|
||||||
ArrayAdapter<T>(context, layoutId, items) {
|
ArrayAdapter<T>(context, layoutId, items) {
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ani.dantotsu.download.anime
|
package ani.dantotsu.download.anime
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
@ -38,7 +37,6 @@ class OfflineAnimeAdapter(
|
||||||
return position.toLong()
|
return position.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||||
|
|
||||||
val view: View = convertView ?: when (style) {
|
val view: View = convertView ?: when (style) {
|
||||||
|
@ -61,14 +59,14 @@ class OfflineAnimeAdapter(
|
||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
||||||
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
val episodes = view.findViewById<TextView>(R.id.itemTotal)
|
||||||
episodes.text = " Episodes"
|
episodes.text = context.getString(R.string.episodes)
|
||||||
bannerView.setImageURI(item.banner ?: item.image)
|
bannerView.setImageURI(item.banner ?: item.image)
|
||||||
totalepisodes.text = item.totalEpisodeList
|
totalepisodes.text = item.totalEpisodeList
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
val watchedEpisodes =
|
val watchedEpisodes =
|
||||||
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
||||||
watchedEpisodes.text = item.watchedEpisode
|
watchedEpisodes.text = item.watchedEpisode
|
||||||
totalepisodes.text = " | " + item.totalEpisode
|
totalepisodes.text = context.getString(R.string.total_divider, item.totalEpisode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind item data to the views
|
// Bind item data to the views
|
||||||
|
|
|
@ -37,7 +37,6 @@ class OfflineMangaAdapter(
|
||||||
return position.toLong()
|
return position.toLong()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||||
|
|
||||||
val view: View = convertView ?: when (style) {
|
val view: View = convertView ?: when (style) {
|
||||||
|
@ -60,14 +59,14 @@ class OfflineMangaAdapter(
|
||||||
if (style == 0) {
|
if (style == 0) {
|
||||||
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
val bannerView = view.findViewById<ImageView>(R.id.itemCompactBanner) // for large view
|
||||||
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
val chapters = view.findViewById<TextView>(R.id.itemTotal)
|
||||||
chapters.text = " Chapters"
|
chapters.text = context.getString(R.string.chapters)
|
||||||
bannerView.setImageURI(item.banner ?: item.image)
|
bannerView.setImageURI(item.banner ?: item.image)
|
||||||
totalChapter.text = item.totalChapter
|
totalChapter.text = item.totalChapter
|
||||||
} else if (style == 1) {
|
} else if (style == 1) {
|
||||||
val readChapter =
|
val readChapter =
|
||||||
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
view.findViewById<TextView>(R.id.itemCompactUserProgress) // for compact view
|
||||||
readChapter.text = item.readChapter
|
readChapter.text = item.readChapter
|
||||||
totalChapter.text = " | " + item.totalChapter
|
totalChapter.text = context.getString(R.string.total_divider, item.totalChapter)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind item data to the views
|
// Bind item data to the views
|
||||||
|
|
|
@ -24,7 +24,6 @@ class AuthorAdapter(
|
||||||
return AuthorViewHolder(binding)
|
return AuthorViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder:AuthorViewHolder, position: Int) {
|
override fun onBindViewHolder(holder:AuthorViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
setAnimation(binding.root.context, holder.binding.root)
|
setAnimation(binding.root.context, holder.binding.root)
|
||||||
|
|
|
@ -34,7 +34,6 @@ class CalendarActivity : AppCompatActivity() {
|
||||||
private var selectedTabIdx = 1
|
private var selectedTabIdx = 1
|
||||||
private val model: OtherDetailsViewModel by viewModels()
|
private val model: OtherDetailsViewModel by viewModels()
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,12 @@ class CharacterAdapter(
|
||||||
return CharacterViewHolder(binding)
|
return CharacterViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: CharacterViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: CharacterViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
setAnimation(binding.root.context, holder.binding.root)
|
setAnimation(binding.root.context, holder.binding.root)
|
||||||
val character = characterList[position]
|
val character = characterList[position]
|
||||||
binding.itemCompactRelation.text = character.role + " "
|
val whitespace = "${character.role} "
|
||||||
|
binding.itemCompactRelation.text = whitespace
|
||||||
binding.itemCompactImage.loadImage(character.image)
|
binding.itemCompactImage.loadImage(character.image)
|
||||||
binding.itemCompactTitle.text = character.name
|
binding.itemCompactTitle.text = character.name
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,16 @@ class CharacterDetailsAdapter(private val character: Character, private val acti
|
||||||
return GenreViewHolder(binding)
|
return GenreViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: GenreViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: GenreViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
val desc =
|
val desc =
|
||||||
(if (character.age != "null") currActivity()!!.getString(R.string.age) + " " + character.age else "") +
|
(if (character.age != "null") "${currActivity()!!.getString(R.string.age)} ${character.age}" else "") +
|
||||||
(if (character.dateOfBirth.toString() != "") currActivity()!!.getString(R.string.birthday) + " " + character.dateOfBirth.toString() else "") +
|
(if (character.dateOfBirth.toString() != "")
|
||||||
(if (character.gender != "null") currActivity()!!.getString(R.string.gender) + " " + when (character.gender) {
|
"${currActivity()!!.getString(R.string.birthday)} ${character.dateOfBirth.toString()}" else "") +
|
||||||
"Male" -> currActivity()!!.getString(R.string.male)
|
(if (character.gender != "null")
|
||||||
"Female" -> currActivity()!!.getString(R.string.female)
|
currActivity()!!.getString(R.string.gender) + " " + when (character.gender) {
|
||||||
|
currActivity()!!.getString(R.string.male) -> currActivity()!!.getString(R.string.male)
|
||||||
|
currActivity()!!.getString(R.string.female) -> currActivity()!!.getString(R.string.female)
|
||||||
else -> character.gender
|
else -> character.gender
|
||||||
} else "") + "\n" + character.description
|
} else "") + "\n" + character.description
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ class MediaAdaptor(
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
when (type) {
|
when (type) {
|
||||||
0 -> {
|
0 -> {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
var anime = true
|
var anime = true
|
||||||
private var adult = false
|
private var adult = false
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
var media: Media = intent.getSerialized("media") ?: mediaSingleton ?: emptyMedia()
|
var media: Media = intent.getSerialized("media") ?: mediaSingleton ?: emptyMedia()
|
||||||
|
@ -85,8 +85,7 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
if (id != -1) {
|
if (id != -1) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
media =
|
media = Anilist.query.getMedia(id, false) ?: emptyMedia()
|
||||||
Anilist.query.getMedia(id, false) ?: emptyMedia()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,9 +151,10 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
|
|
||||||
binding.mediaCoverImage.loadImage(media.cover)
|
binding.mediaCoverImage.loadImage(media.cover)
|
||||||
binding.mediaCoverImage.setOnLongClickListener {
|
binding.mediaCoverImage.setOnLongClickListener {
|
||||||
|
val coverTitle = "${media.userPreferredName}[Cover]"
|
||||||
ImageViewDialog.newInstance(
|
ImageViewDialog.newInstance(
|
||||||
this,
|
this,
|
||||||
media.userPreferredName + "[Cover]",
|
coverTitle,
|
||||||
media.cover
|
media.cover
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,10 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongClick(event: MotionEvent) {
|
override fun onLongClick(event: MotionEvent) {
|
||||||
|
val bannerTitle = "${media.userPreferredName}[Banner]"
|
||||||
ImageViewDialog.newInstance(
|
ImageViewDialog.newInstance(
|
||||||
this@MediaDetailsActivity,
|
this@MediaDetailsActivity,
|
||||||
media.userPreferredName + "[Banner]",
|
bannerTitle,
|
||||||
media.banner ?: media.cover
|
media.banner ?: media.cover
|
||||||
)
|
)
|
||||||
banner.performClick()
|
banner.performClick()
|
||||||
|
@ -181,7 +182,8 @@ class MediaDetailsActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedLi
|
||||||
})
|
})
|
||||||
banner.setOnTouchListener { _, motionEvent -> gestureDetector.onTouchEvent(motionEvent);true }
|
banner.setOnTouchListener { _, motionEvent -> gestureDetector.onTouchEvent(motionEvent);true }
|
||||||
if (PrefManager.getVal(PrefName.Incognito)) {
|
if (PrefManager.getVal(PrefName.Incognito)) {
|
||||||
binding.mediaTitle.text = " ${media.userPreferredName}"
|
val mediaTitle = " ${media.userPreferredName}"
|
||||||
|
binding.mediaTitle.text = mediaTitle
|
||||||
binding.incognito.visibility = View.VISIBLE
|
binding.incognito.visibility = View.VISIBLE
|
||||||
} else {
|
} else {
|
||||||
binding.mediaTitle.text = media.userPreferredName
|
binding.mediaTitle.text = media.userPreferredName
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.io.Serializable
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
class MediaInfoFragment : Fragment() {
|
class MediaInfoFragment : Fragment() {
|
||||||
private var _binding: FragmentMediaInfoBinding? = null
|
private var _binding: FragmentMediaInfoBinding? = null
|
||||||
private val binding get() = _binding!!
|
private val binding get() = _binding!!
|
||||||
|
@ -48,6 +48,8 @@ class MediaInfoFragment : Fragment() {
|
||||||
private var type = "ANIME"
|
private var type = "ANIME"
|
||||||
private val genreModel: GenresViewModel by activityViewModels()
|
private val genreModel: GenresViewModel by activityViewModels()
|
||||||
|
|
||||||
|
private val tripleTab = "\t\t\t"
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
|
@ -80,14 +82,16 @@ class MediaInfoFragment : Fragment() {
|
||||||
|
|
||||||
binding.mediaInfoProgressBar.visibility = View.GONE
|
binding.mediaInfoProgressBar.visibility = View.GONE
|
||||||
binding.mediaInfoContainer.visibility = View.VISIBLE
|
binding.mediaInfoContainer.visibility = View.VISIBLE
|
||||||
binding.mediaInfoName.text = "\t\t\t" + (media.name ?: media.nameRomaji)
|
val infoName = tripleTab + (media.name ?: media.nameRomaji)
|
||||||
|
binding.mediaInfoName.text = infoName
|
||||||
binding.mediaInfoName.setOnLongClickListener {
|
binding.mediaInfoName.setOnLongClickListener {
|
||||||
copyToClipboard(media.name ?: media.nameRomaji)
|
copyToClipboard(media.name ?: media.nameRomaji)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
if (media.name != null) binding.mediaInfoNameRomajiContainer.visibility =
|
if (media.name != null) binding.mediaInfoNameRomajiContainer.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.mediaInfoNameRomaji.text = "\t\t\t" + media.nameRomaji
|
val infoNameRomanji = tripleTab + media.nameRomaji
|
||||||
|
binding.mediaInfoNameRomaji.text = infoNameRomanji
|
||||||
binding.mediaInfoNameRomaji.setOnLongClickListener {
|
binding.mediaInfoNameRomaji.setOnLongClickListener {
|
||||||
copyToClipboard(media.nameRomaji)
|
copyToClipboard(media.nameRomaji)
|
||||||
true
|
true
|
||||||
|
@ -129,8 +133,9 @@ class MediaInfoFragment : Fragment() {
|
||||||
}
|
}
|
||||||
binding.mediaInfoDurationContainer.visibility = View.VISIBLE
|
binding.mediaInfoDurationContainer.visibility = View.VISIBLE
|
||||||
binding.mediaInfoSeasonContainer.visibility = View.VISIBLE
|
binding.mediaInfoSeasonContainer.visibility = View.VISIBLE
|
||||||
binding.mediaInfoSeason.text =
|
val seasonInfo = "${(media.anime.season ?: "??")} ${(media.anime.seasonYear ?: "??")}"
|
||||||
(media.anime.season ?: "??") + " " + (media.anime.seasonYear ?: "??")
|
binding.mediaInfoSeason.text = seasonInfo
|
||||||
|
|
||||||
if (media.anime.mainStudio != null) {
|
if (media.anime.mainStudio != null) {
|
||||||
binding.mediaInfoStudioContainer.visibility = View.VISIBLE
|
binding.mediaInfoStudioContainer.visibility = View.VISIBLE
|
||||||
binding.mediaInfoStudio.text = media.anime.mainStudio!!.name
|
binding.mediaInfoStudio.text = media.anime.mainStudio!!.name
|
||||||
|
@ -164,9 +169,12 @@ class MediaInfoFragment : Fragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.mediaInfoTotalTitle.setText(R.string.total_eps)
|
binding.mediaInfoTotalTitle.setText(R.string.total_eps)
|
||||||
binding.mediaInfoTotal.text =
|
val infoTotal = if (media.anime.nextAiringEpisode != null)
|
||||||
if (media.anime.nextAiringEpisode != null) (media.anime.nextAiringEpisode.toString() + " | " + (media.anime.totalEpisodes
|
"${media.anime.nextAiringEpisode} | ${media.anime.totalEpisodes ?: "~"}"
|
||||||
?: "~").toString()) else (media.anime.totalEpisodes ?: "~").toString()
|
else
|
||||||
|
(media.anime.totalEpisodes ?: "~").toString()
|
||||||
|
binding.mediaInfoTotal.text = infoTotal
|
||||||
|
|
||||||
} else if (media.manga != null) {
|
} else if (media.manga != null) {
|
||||||
type = "MANGA"
|
type = "MANGA"
|
||||||
binding.mediaInfoTotalTitle.setText(R.string.total_chaps)
|
binding.mediaInfoTotalTitle.setText(R.string.total_chaps)
|
||||||
|
@ -193,8 +201,9 @@ class MediaInfoFragment : Fragment() {
|
||||||
(media.description ?: "null").replace("\\n", "<br>").replace("\\\"", "\""),
|
(media.description ?: "null").replace("\\n", "<br>").replace("\\\"", "\""),
|
||||||
HtmlCompat.FROM_HTML_MODE_LEGACY
|
HtmlCompat.FROM_HTML_MODE_LEGACY
|
||||||
)
|
)
|
||||||
binding.mediaInfoDescription.text =
|
val infoDesc = tripleTab + if (desc.toString() != "null") desc else getString(R.string.no_description_available)
|
||||||
"\t\t\t" + if (desc.toString() != "null") desc else getString(R.string.no_description_available)
|
binding.mediaInfoDescription.text = infoDesc
|
||||||
|
|
||||||
binding.mediaInfoDescription.setOnClickListener {
|
binding.mediaInfoDescription.setOnClickListener {
|
||||||
if (binding.mediaInfoDescription.maxLines == 5) {
|
if (binding.mediaInfoDescription.maxLines == 5) {
|
||||||
ObjectAnimator.ofInt(binding.mediaInfoDescription, "maxLines", 100)
|
ObjectAnimator.ofInt(binding.mediaInfoDescription, "maxLines", 100)
|
||||||
|
|
|
@ -36,7 +36,6 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
binding.mediaListContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { bottomMargin += navBarHeight }
|
binding.mediaListContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { bottomMargin += navBarHeight }
|
||||||
var media: Media?
|
var media: Media?
|
||||||
|
@ -168,9 +167,10 @@ class MediaListDialogFragment : BottomSheetDialogFragment() {
|
||||||
val init =
|
val init =
|
||||||
if (binding.mediaListProgress.text.toString() != "") binding.mediaListProgress.text.toString()
|
if (binding.mediaListProgress.text.toString() != "") binding.mediaListProgress.text.toString()
|
||||||
.toInt() else 0
|
.toInt() else 0
|
||||||
if (init < (total
|
if (init < (total ?: 5000)) {
|
||||||
?: 5000)
|
val progressText = "${init + 1}"
|
||||||
) binding.mediaListProgress.setText((init + 1).toString())
|
binding.mediaListProgress.setText(progressText)
|
||||||
|
}
|
||||||
if (init + 1 == (total ?: 5000)) {
|
if (init + 1 == (total ?: 5000)) {
|
||||||
binding.mediaListStatus.setText(statusStrings[2], false)
|
binding.mediaListStatus.setText(statusStrings[2], false)
|
||||||
onComplete()
|
onComplete()
|
||||||
|
|
|
@ -54,7 +54,6 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
binding.mediaListContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { bottomMargin += navBarHeight }
|
binding.mediaListContainer.updateLayoutParams<ViewGroup.MarginLayoutParams> { bottomMargin += navBarHeight }
|
||||||
val scope = viewLifecycleOwner.lifecycleScope
|
val scope = viewLifecycleOwner.lifecycleScope
|
||||||
|
@ -68,7 +67,7 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||||
MAL.query.deleteList(media.anime != null, media.idMAL)
|
MAL.query.deleteList(media.anime != null, media.idMAL)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
snackString("Failed to delete because of... ${e.message}")
|
snackString(getString(R.string.delete_fail_reason, e.message))
|
||||||
}
|
}
|
||||||
return@withContext
|
return@withContext
|
||||||
}
|
}
|
||||||
|
@ -154,7 +153,10 @@ class MediaListDialogSmallFragment : BottomSheetDialogFragment() {
|
||||||
val init =
|
val init =
|
||||||
if (binding.mediaListProgress.text.toString() != "") binding.mediaListProgress.text.toString()
|
if (binding.mediaListProgress.text.toString() != "") binding.mediaListProgress.text.toString()
|
||||||
.toInt() else 0
|
.toInt() else 0
|
||||||
if (init < (total ?: 5000)) binding.mediaListProgress.setText((init + 1).toString())
|
if (init < (total ?: 5000)) {
|
||||||
|
val progressText = "${init + 1}"
|
||||||
|
binding.mediaListProgress.setText(progressText)
|
||||||
|
}
|
||||||
if (init + 1 == (total ?: 5000)) {
|
if (init + 1 == (total ?: 5000)) {
|
||||||
binding.mediaListStatus.setText(statusStrings[2], false)
|
binding.mediaListStatus.setText(statusStrings[2], false)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ProgressAdapter(private val horizontal: Boolean = true, searched: Boolean)
|
||||||
return ProgressViewHolder(binding)
|
return ProgressViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onBindViewHolder(holder: ProgressViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ProgressViewHolder, position: Int) {
|
||||||
val progressBar = holder.binding.root
|
val progressBar = holder.binding.root
|
||||||
bar = progressBar
|
bar = progressBar
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ani.dantotsu.media
|
package ani.dantotsu.media
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
@ -22,7 +21,6 @@ abstract class SourceAdapter(
|
||||||
return SourceViewHolder(binding)
|
return SourceViewHolder(binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: SourceViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: SourceViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
val character = sources[position]
|
val character = sources[position]
|
||||||
|
|
|
@ -56,7 +56,6 @@ class AnimeWatchAdapter(
|
||||||
private var nestedDialog: AlertDialog? = null
|
private var nestedDialog: AlertDialog? = null
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
_binding = binding
|
_binding = binding
|
||||||
|
@ -219,9 +218,9 @@ class AnimeWatchAdapter(
|
||||||
else -> dialogBinding.animeSourceList
|
else -> dialogBinding.animeSourceList
|
||||||
}
|
}
|
||||||
when (style) {
|
when (style) {
|
||||||
0 -> dialogBinding.layoutText.text = "List"
|
0 -> dialogBinding.layoutText.setText(R.string.list)
|
||||||
1 -> dialogBinding.layoutText.text = "Grid"
|
1 -> dialogBinding.layoutText.setText(R.string.grid)
|
||||||
2 -> dialogBinding.layoutText.text = "Compact"
|
2 -> dialogBinding.layoutText.setText(R.string.compact)
|
||||||
else -> dialogBinding.animeSourceList
|
else -> dialogBinding.animeSourceList
|
||||||
}
|
}
|
||||||
selected.alpha = 1f
|
selected.alpha = 1f
|
||||||
|
@ -233,24 +232,24 @@ class AnimeWatchAdapter(
|
||||||
dialogBinding.animeSourceList.setOnClickListener {
|
dialogBinding.animeSourceList.setOnClickListener {
|
||||||
selected(it as ImageButton)
|
selected(it as ImageButton)
|
||||||
style = 0
|
style = 0
|
||||||
dialogBinding.layoutText.text = "List"
|
dialogBinding.layoutText.setText(R.string.list)
|
||||||
run = true
|
run = true
|
||||||
}
|
}
|
||||||
dialogBinding.animeSourceGrid.setOnClickListener {
|
dialogBinding.animeSourceGrid.setOnClickListener {
|
||||||
selected(it as ImageButton)
|
selected(it as ImageButton)
|
||||||
style = 1
|
style = 1
|
||||||
dialogBinding.layoutText.text = "Grid"
|
dialogBinding.layoutText.setText(R.string.grid)
|
||||||
run = true
|
run = true
|
||||||
}
|
}
|
||||||
dialogBinding.animeSourceCompact.setOnClickListener {
|
dialogBinding.animeSourceCompact.setOnClickListener {
|
||||||
selected(it as ImageButton)
|
selected(it as ImageButton)
|
||||||
style = 2
|
style = 2
|
||||||
dialogBinding.layoutText.text = "Compact"
|
dialogBinding.layoutText.setText(R.string.compact)
|
||||||
run = true
|
run = true
|
||||||
}
|
}
|
||||||
dialogBinding.animeWebviewContainer.setOnClickListener {
|
dialogBinding.animeWebviewContainer.setOnClickListener {
|
||||||
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
|
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
|
||||||
toast("WebView not installed")
|
toast(R.string.webview_not_installed)
|
||||||
}
|
}
|
||||||
//start CookieCatcher activity
|
//start CookieCatcher activity
|
||||||
if (watchSources.names.isNotEmpty() && source in 0 until watchSources.names.size) {
|
if (watchSources.names.isNotEmpty() && source in 0 until watchSources.names.size) {
|
||||||
|
@ -303,7 +302,6 @@ class AnimeWatchAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Chips
|
//Chips
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun updateChips(limit: Int, names: Array<String>, arr: Array<Int>, selected: Int = 0) {
|
fun updateChips(limit: Int, names: Array<String>, arr: Array<Int>, selected: Int = 0) {
|
||||||
val binding = _binding
|
val binding = _binding
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
|
@ -325,7 +323,8 @@ class AnimeWatchAdapter(
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
chip.text = "${names[limit * (position)]} - ${names[last - 1]}"
|
val chipText = "${names[limit * (position)]} - ${names[last - 1]}"
|
||||||
|
chip.text = chipText
|
||||||
chip.setTextColor(
|
chip.setTextColor(
|
||||||
ContextCompat.getColorStateList(
|
ContextCompat.getColorStateList(
|
||||||
fragment.requireContext(),
|
fragment.requireContext(),
|
||||||
|
@ -359,7 +358,6 @@ class AnimeWatchAdapter(
|
||||||
_binding?.animeSourceChipGroup?.removeAllViews()
|
_binding?.animeSourceChipGroup?.removeAllViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun handleEpisodes() {
|
fun handleEpisodes() {
|
||||||
val binding = _binding
|
val binding = _binding
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
|
@ -367,9 +365,9 @@ class AnimeWatchAdapter(
|
||||||
val episodes = media.anime.episodes!!.keys.toTypedArray()
|
val episodes = media.anime.episodes!!.keys.toTypedArray()
|
||||||
|
|
||||||
val anilistEp = (media.userProgress ?: 0).plus(1)
|
val anilistEp = (media.userProgress ?: 0).plus(1)
|
||||||
val appEp =
|
val appEp = PrefManager.getCustomVal<String?>(
|
||||||
PrefManager.getCustomVal<String?>("${media.id}_current_ep", "")?.toIntOrNull()
|
"${media.id}_current_ep", ""
|
||||||
?: 1
|
)?.toIntOrNull() ?: 1
|
||||||
|
|
||||||
var continueEp = (if (anilistEp > appEp) anilistEp else appEp).toString()
|
var continueEp = (if (anilistEp > appEp) anilistEp else appEp).toString()
|
||||||
if (episodes.contains(continueEp)) {
|
if (episodes.contains(continueEp)) {
|
||||||
|
@ -405,15 +403,19 @@ class AnimeWatchAdapter(
|
||||||
ep.thumb ?: FileUrl[media.banner ?: media.cover], 0
|
ep.thumb ?: FileUrl[media.banner ?: media.cover], 0
|
||||||
)
|
)
|
||||||
if (ep.filler) binding.itemEpisodeFillerView.visibility = View.VISIBLE
|
if (ep.filler) binding.itemEpisodeFillerView.visibility = View.VISIBLE
|
||||||
|
|
||||||
binding.animeSourceContinueText.text =
|
binding.animeSourceContinueText.text =
|
||||||
currActivity()!!.getString(R.string.continue_episode) + "${ep.number}${if (ep.filler) " - Filler" else ""}${"\n$cleanedTitle"}"
|
currActivity()!!.getString(R.string.continue_episode, ep.number, if (ep.filler)
|
||||||
|
currActivity()!!.getString(R.string.filler_tag)
|
||||||
|
else
|
||||||
|
"", cleanedTitle)
|
||||||
binding.animeSourceContinue.setOnClickListener {
|
binding.animeSourceContinue.setOnClickListener {
|
||||||
fragment.onEpisodeClick(continueEp)
|
fragment.onEpisodeClick(continueEp)
|
||||||
}
|
}
|
||||||
if (fragment.continueEp) {
|
if (fragment.continueEp) {
|
||||||
if ((binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams).weight < PrefManager.getVal<Float>(
|
if (
|
||||||
PrefName.WatchPercentage
|
(binding.itemEpisodeProgress.layoutParams as LinearLayout.LayoutParams)
|
||||||
)
|
.weight < PrefManager.getVal<Float>(PrefName.WatchPercentage)
|
||||||
) {
|
) {
|
||||||
binding.animeSourceContinue.performClick()
|
binding.animeSourceContinue.performClick()
|
||||||
fragment.continueEp = false
|
fragment.continueEp = false
|
||||||
|
|
|
@ -98,7 +98,6 @@ class EpisodeAdapter(
|
||||||
return type
|
return type
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
val ep = arr[position]
|
val ep = arr[position]
|
||||||
val title = if (!ep.title.isNullOrEmpty() && ep.title != "null") {
|
val title = if (!ep.title.isNullOrEmpty() && ep.title != "null") {
|
||||||
|
|
|
@ -110,7 +110,7 @@ import kotlin.math.min
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityListener {
|
class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityListener {
|
||||||
|
|
||||||
private val resumeWindow = "resumeWindow"
|
private val resumeWindow = "resumeWindow"
|
||||||
|
@ -703,11 +703,13 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
fun seek(forward: Boolean, event: MotionEvent? = null) {
|
fun seek(forward: Boolean, event: MotionEvent? = null) {
|
||||||
val seekTime = PrefManager.getVal<Int>(PrefName.SeekTime)
|
val seekTime = PrefManager.getVal<Int>(PrefName.SeekTime)
|
||||||
val (card, text) = if (forward) {
|
val (card, text) = if (forward) {
|
||||||
forwardText.text = "+${seekTime * ++seekTimesF}"
|
val text = "+${seekTime * ++seekTimesF}"
|
||||||
|
forwardText.text = text
|
||||||
handler.post { exoPlayer.seekTo(exoPlayer.currentPosition + seekTime * 1000) }
|
handler.post { exoPlayer.seekTo(exoPlayer.currentPosition + seekTime * 1000) }
|
||||||
fastForwardCard to forwardText
|
fastForwardCard to forwardText
|
||||||
} else {
|
} else {
|
||||||
rewindText.text = "-${seekTime * ++seekTimesR}"
|
val text = "-${seekTime * ++seekTimesR}"
|
||||||
|
rewindText.text = text
|
||||||
handler.post { exoPlayer.seekTo(exoPlayer.currentPosition - seekTime * 1000) }
|
handler.post { exoPlayer.seekTo(exoPlayer.currentPosition - seekTime * 1000) }
|
||||||
fastRewindCard to rewindText
|
fastRewindCard to rewindText
|
||||||
}
|
}
|
||||||
|
@ -1659,7 +1661,7 @@ class ExoplayerView : AppCompatActivity(), Player.Listener, SessionAvailabilityL
|
||||||
|
|
||||||
aspectRatio = Rational(width, height)
|
aspectRatio = Rational(width, height)
|
||||||
|
|
||||||
videoInfo.text = "Quality: ${height}p"
|
videoInfo.text = getString(R.string.video_quality, height)
|
||||||
|
|
||||||
if (exoPlayer.duration < playbackPosition)
|
if (exoPlayer.duration < playbackPosition)
|
||||||
exoPlayer.seekTo(0)
|
exoPlayer.seekTo(0)
|
||||||
|
|
|
@ -303,7 +303,6 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: UrlViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: UrlViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
val video = extractor.videos[position]
|
val video = extractor.videos[position]
|
||||||
|
@ -403,11 +402,11 @@ class SelectorDialogFragment : BottomSheetDialogFragment() {
|
||||||
}
|
}
|
||||||
if (video.format == VideoType.CONTAINER) {
|
if (video.format == VideoType.CONTAINER) {
|
||||||
binding.urlSize.isVisible = video.size != null
|
binding.urlSize.isVisible = video.size != null
|
||||||
binding.urlSize.text =
|
|
||||||
// if video size is null or 0, show "Unknown Size" else show the size in MB
|
// if video size is null or 0, show "Unknown Size" else show the size in MB
|
||||||
(if (video.extraNote != null) " : " else "") + (if (video.size == 0.0) "Unknown Size" else (DecimalFormat(
|
val sizeText = getString(R.string.mb_size, "${if (video.extraNote != null) " : " else ""}${
|
||||||
"#.##"
|
if (video.size == 0.0) getString(R.string.size_unknown) else DecimalFormat("#.##").format(video.size ?: 0)
|
||||||
).format(video.size ?: 0).toString() + " MB"))
|
}")
|
||||||
|
binding.urlSize.text = sizeText
|
||||||
}
|
}
|
||||||
binding.urlNote.visibility = View.VISIBLE
|
binding.urlNote.visibility = View.VISIBLE
|
||||||
binding.urlNote.text = video.format.name
|
binding.urlNote.text = video.format.name
|
||||||
|
|
|
@ -11,6 +11,7 @@ import ani.dantotsu.connections.comments.Comment
|
||||||
import ani.dantotsu.connections.comments.CommentsAPI
|
import ani.dantotsu.connections.comments.CommentsAPI
|
||||||
import ani.dantotsu.copyToClipboard
|
import ani.dantotsu.copyToClipboard
|
||||||
import ani.dantotsu.databinding.ItemCommentsBinding
|
import ani.dantotsu.databinding.ItemCommentsBinding
|
||||||
|
import ani.dantotsu.getAppString
|
||||||
import ani.dantotsu.loadImage
|
import ani.dantotsu.loadImage
|
||||||
import ani.dantotsu.others.ImageViewDialog
|
import ani.dantotsu.others.ImageViewDialog
|
||||||
import ani.dantotsu.profile.ProfileActivity
|
import ani.dantotsu.profile.ProfileActivity
|
||||||
|
@ -52,7 +53,6 @@ class CommentItem(val comment: Comment,
|
||||||
adapter.add(repliesSection)
|
adapter.add(repliesSection)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun bind(viewBinding: ItemCommentsBinding, position: Int) {
|
override fun bind(viewBinding: ItemCommentsBinding, position: Int) {
|
||||||
binding = viewBinding
|
binding = viewBinding
|
||||||
setAnimation(binding.root.context, binding.root)
|
setAnimation(binding.root.context, binding.root)
|
||||||
|
@ -76,8 +76,15 @@ class CommentItem(val comment: Comment,
|
||||||
if ((comment.replyCount ?: 0) > 0) {
|
if ((comment.replyCount ?: 0) > 0) {
|
||||||
viewBinding.commentTotalReplies.visibility = View.VISIBLE
|
viewBinding.commentTotalReplies.visibility = View.VISIBLE
|
||||||
viewBinding.commentRepliesDivider.visibility = View.VISIBLE
|
viewBinding.commentRepliesDivider.visibility = View.VISIBLE
|
||||||
viewBinding.commentTotalReplies.text = if(repliesVisible) "Hide Replies" else
|
viewBinding.commentTotalReplies.context.run {
|
||||||
"View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}"
|
viewBinding.commentTotalReplies.text = if (repliesVisible)
|
||||||
|
getString(R.string.hide_replies)
|
||||||
|
else
|
||||||
|
if (comment.replyCount == 1)
|
||||||
|
getString(R.string.view_reply)
|
||||||
|
else
|
||||||
|
getString(R.string.view_replies_count, comment.replyCount)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viewBinding.commentTotalReplies.visibility = View.GONE
|
viewBinding.commentTotalReplies.visibility = View.GONE
|
||||||
viewBinding.commentRepliesDivider.visibility = View.GONE
|
viewBinding.commentRepliesDivider.visibility = View.GONE
|
||||||
|
@ -87,10 +94,15 @@ class CommentItem(val comment: Comment,
|
||||||
if (repliesVisible) {
|
if (repliesVisible) {
|
||||||
repliesSection.clear()
|
repliesSection.clear()
|
||||||
removeSubCommentIds()
|
removeSubCommentIds()
|
||||||
viewBinding.commentTotalReplies.text = "View ${comment.replyCount} repl${if (comment.replyCount == 1) "y" else "ies"}"
|
viewBinding.commentTotalReplies.context.run {
|
||||||
|
viewBinding.commentTotalReplies.text = if (comment.replyCount == 1)
|
||||||
|
getString(R.string.view_reply)
|
||||||
|
else
|
||||||
|
getString(R.string.view_replies_count, comment.replyCount)
|
||||||
|
}
|
||||||
repliesVisible = false
|
repliesVisible = false
|
||||||
} else {
|
} else {
|
||||||
viewBinding.commentTotalReplies.text = "Hide Replies"
|
viewBinding.commentTotalReplies.setText(R.string.hide_replies)
|
||||||
repliesSection.clear()
|
repliesSection.clear()
|
||||||
commentsFragment.viewReplyCallback(this)
|
commentsFragment.viewReplyCallback(this)
|
||||||
repliesVisible = true
|
repliesVisible = true
|
||||||
|
@ -128,35 +140,37 @@ class CommentItem(val comment: Comment,
|
||||||
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
|
viewBinding.modBadge.visibility = if (comment.isMod == true) View.VISIBLE else View.GONE
|
||||||
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE
|
viewBinding.adminBadge.visibility = if (comment.isAdmin == true) View.VISIBLE else View.GONE
|
||||||
viewBinding.commentDelete.setOnClickListener {
|
viewBinding.commentDelete.setOnClickListener {
|
||||||
dialogBuilder("Delete Comment", "Are you sure you want to delete this comment?") {
|
dialogBuilder(getAppString(R.string.delete_comment), getAppString(R.string.delete_comment_confirm)) {
|
||||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||||
scope.launch {
|
|
||||||
val success = CommentsAPI.deleteComment(comment.commentId)
|
val success = CommentsAPI.deleteComment(comment.commentId)
|
||||||
if (success) {
|
if (success) {
|
||||||
snackString("Comment Deleted")
|
snackString(R.string.comment_deleted)
|
||||||
parentSection.remove(this@CommentItem)
|
parentSection.remove(this@CommentItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewBinding.commentBanUser.setOnClickListener {
|
viewBinding.commentBanUser.setOnClickListener {
|
||||||
dialogBuilder("Ban User", "Are you sure you want to ban this user?") {
|
dialogBuilder(getAppString(R.string.ban_user), getAppString(R.string.ban_user_confirm)) {
|
||||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||||
scope.launch {
|
|
||||||
val success = CommentsAPI.banUser(comment.userId)
|
val success = CommentsAPI.banUser(comment.userId)
|
||||||
if (success) {
|
if (success) {
|
||||||
snackString("User Banned")
|
snackString(R.string.user_banned)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
viewBinding.commentReport.setOnClickListener {
|
viewBinding.commentReport.setOnClickListener {
|
||||||
dialogBuilder("Report Comment", "Only report comments that violate the rules. Are you sure you want to report this comment?") {
|
dialogBuilder(getAppString(R.string.report_comment), getAppString(R.string.report_comment_confirm)) {
|
||||||
val scope = CoroutineScope(Dispatchers.Main + SupervisorJob())
|
CoroutineScope(Dispatchers.Main + SupervisorJob()).launch {
|
||||||
scope.launch {
|
val success = CommentsAPI.reportComment(
|
||||||
val success = CommentsAPI.reportComment(comment.commentId, comment.username, commentsFragment.mediaName, comment.userId)
|
comment.commentId,
|
||||||
|
comment.username,
|
||||||
|
commentsFragment.mediaName,
|
||||||
|
comment.userId
|
||||||
|
)
|
||||||
if (success) {
|
if (success) {
|
||||||
snackString("Comment Reported")
|
snackString(R.string.comment_reported)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +224,8 @@ class CommentItem(val comment: Comment,
|
||||||
}
|
}
|
||||||
comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) }
|
comment.profilePictureUrl?.let { viewBinding.commentUserAvatar.loadImage(it) }
|
||||||
viewBinding.commentUserName.text = comment.username
|
viewBinding.commentUserName.text = comment.username
|
||||||
viewBinding.commentUserLevel.text = "[${levelColor.second}]"
|
val userColor = "[${levelColor.second}]"
|
||||||
|
viewBinding.commentUserLevel.text = userColor
|
||||||
viewBinding.commentUserLevel.setTextColor(levelColor.first)
|
viewBinding.commentUserLevel.setTextColor(levelColor.first)
|
||||||
viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp)
|
viewBinding.commentUserTime.text = formatTimestamp(comment.timestamp)
|
||||||
}
|
}
|
||||||
|
@ -272,6 +287,7 @@ class CommentItem(val comment: Comment,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
private fun formatTimestamp(timestamp: String): String {
|
private fun formatTimestamp(timestamp: String): String {
|
||||||
return try {
|
return try {
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
||||||
|
@ -297,6 +313,7 @@ class CommentItem(val comment: Comment,
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@SuppressLint("SimpleDateFormat")
|
||||||
fun timestampToMillis(timestamp: String): Long {
|
fun timestampToMillis(timestamp: String): Long {
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
|
||||||
dateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
dateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
|
|
@ -523,11 +523,10 @@ class CommentsFragment : Fragment() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun replyTo(comment: CommentItem, username: String) {
|
fun replyTo(comment: CommentItem, username: String) {
|
||||||
if (comment.isReplying) {
|
if (comment.isReplying) {
|
||||||
activity.binding.commentReplyToContainer.visibility = View.VISIBLE
|
activity.binding.commentReplyToContainer.visibility = View.VISIBLE
|
||||||
activity.binding.commentReplyTo.text = "Replying to $username"
|
activity.binding.commentReplyTo.text = getString(R.string.replying_to, username)
|
||||||
activity.binding.commentReplyToCancel.setOnClickListener {
|
activity.binding.commentReplyToCancel.setOnClickListener {
|
||||||
comment.replying(false)
|
comment.replying(false)
|
||||||
replyCallback(comment)
|
replyCallback(comment)
|
||||||
|
|
|
@ -262,7 +262,6 @@ class MangaChapterAdapter(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||||
when (holder) {
|
when (holder) {
|
||||||
is ChapterCompactViewHolder -> {
|
is ChapterCompactViewHolder -> {
|
||||||
|
|
|
@ -60,7 +60,6 @@ class MangaReadAdapter(
|
||||||
|
|
||||||
private var nestedDialog: AlertDialog? = null
|
private var nestedDialog: AlertDialog? = null
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
_binding = binding
|
_binding = binding
|
||||||
|
@ -188,8 +187,8 @@ class MangaReadAdapter(
|
||||||
else -> dialogBinding.animeSourceList
|
else -> dialogBinding.animeSourceList
|
||||||
}
|
}
|
||||||
when (style) {
|
when (style) {
|
||||||
0 -> dialogBinding.layoutText.text = "List"
|
0 -> dialogBinding.layoutText.setText(R.string.list)
|
||||||
1 -> dialogBinding.layoutText.text = "Compact"
|
1 -> dialogBinding.layoutText.setText(R.string.compact)
|
||||||
else -> dialogBinding.animeSourceList
|
else -> dialogBinding.animeSourceList
|
||||||
}
|
}
|
||||||
selected.alpha = 1f
|
selected.alpha = 1f
|
||||||
|
@ -201,18 +200,18 @@ class MangaReadAdapter(
|
||||||
dialogBinding.animeSourceList.setOnClickListener {
|
dialogBinding.animeSourceList.setOnClickListener {
|
||||||
selected(it as ImageButton)
|
selected(it as ImageButton)
|
||||||
style = 0
|
style = 0
|
||||||
dialogBinding.layoutText.text = "List"
|
dialogBinding.layoutText.setText(R.string.list)
|
||||||
run = true
|
run = true
|
||||||
}
|
}
|
||||||
dialogBinding.animeSourceCompact.setOnClickListener {
|
dialogBinding.animeSourceCompact.setOnClickListener {
|
||||||
selected(it as ImageButton)
|
selected(it as ImageButton)
|
||||||
style = 1
|
style = 1
|
||||||
dialogBinding.layoutText.text = "Compact"
|
dialogBinding.layoutText.setText(R.string.compact)
|
||||||
run = true
|
run = true
|
||||||
}
|
}
|
||||||
dialogBinding.animeWebviewContainer.setOnClickListener {
|
dialogBinding.animeWebviewContainer.setOnClickListener {
|
||||||
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
|
if (!WebViewUtil.supportsWebView(fragment.requireContext())) {
|
||||||
toast("WebView not installed")
|
toast(R.string.webview_not_installed)
|
||||||
}
|
}
|
||||||
//start CookieCatcher activity
|
//start CookieCatcher activity
|
||||||
if (mangaReadSources.names.isNotEmpty() && source in 0 until mangaReadSources.names.size) {
|
if (mangaReadSources.names.isNotEmpty() && source in 0 until mangaReadSources.names.size) {
|
||||||
|
@ -358,7 +357,6 @@ class MangaReadAdapter(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Chips
|
//Chips
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun updateChips(limit: Int, names: Array<String>, arr: Array<Int>, selected: Int = 0) {
|
fun updateChips(limit: Int, names: Array<String>, arr: Array<Int>, selected: Int = 0) {
|
||||||
val binding = _binding
|
val binding = _binding
|
||||||
if (binding != null) {
|
if (binding != null) {
|
||||||
|
@ -394,7 +392,8 @@ class MangaReadAdapter(
|
||||||
names[last - 1]
|
names[last - 1]
|
||||||
}
|
}
|
||||||
//chip.text = "${names[limit * (position)]} - ${names[last - 1]}"
|
//chip.text = "${names[limit * (position)]} - ${names[last - 1]}"
|
||||||
chip.text = "$startChapterString - $endChapterString"
|
val chipText = "$startChapterString - $endChapterString"
|
||||||
|
chip.text = chipText
|
||||||
chip.setTextColor(
|
chip.setTextColor(
|
||||||
ContextCompat.getColorStateList(
|
ContextCompat.getColorStateList(
|
||||||
fragment.requireContext(),
|
fragment.requireContext(),
|
||||||
|
@ -428,7 +427,6 @@ class MangaReadAdapter(
|
||||||
_binding?.animeSourceChipGroup?.removeAllViews()
|
_binding?.animeSourceChipGroup?.removeAllViews()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun handleChapters() {
|
fun handleChapters() {
|
||||||
|
|
||||||
val binding = _binding
|
val binding = _binding
|
||||||
|
@ -465,7 +463,7 @@ class MangaReadAdapter(
|
||||||
val ep = media.manga.chapters!![continueEp]!!
|
val ep = media.manga.chapters!![continueEp]!!
|
||||||
binding.itemEpisodeImage.loadImage(media.banner ?: media.cover)
|
binding.itemEpisodeImage.loadImage(media.banner ?: media.cover)
|
||||||
binding.animeSourceContinueText.text =
|
binding.animeSourceContinueText.text =
|
||||||
currActivity()!!.getString(R.string.continue_chapter) + "${ep.number}${if (!ep.title.isNullOrEmpty()) "\n${ep.title}" else ""}"
|
currActivity()!!.getString(R.string.continue_chapter, ep.number, if (!ep.title.isNullOrEmpty()) ep.title else "")
|
||||||
binding.animeSourceContinue.setOnClickListener {
|
binding.animeSourceContinue.setOnClickListener {
|
||||||
fragment.onMangaChapterClick(continueEp)
|
fragment.onMangaChapterClick(continueEp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,6 @@ import java.util.*
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.properties.Delegates
|
import kotlin.properties.Delegates
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
class MangaReaderActivity : AppCompatActivity() {
|
class MangaReaderActivity : AppCompatActivity() {
|
||||||
private val mangaCache = Injekt.get<MangaCache>()
|
private val mangaCache = Injekt.get<MangaCache>()
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ class UrlAdapter(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: UrlViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: UrlViewHolder, position: Int) {
|
||||||
val binding = holder.binding
|
val binding = holder.binding
|
||||||
val url = urls[position]
|
val url = urls[position]
|
||||||
|
|
|
@ -33,7 +33,6 @@ class ListActivity : AppCompatActivity() {
|
||||||
private val scope = lifecycleScope
|
private val scope = lifecycleScope
|
||||||
private var selectedTabIdx = 0
|
private var selectedTabIdx = 0
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
@ -83,8 +82,8 @@ class ListActivity : AppCompatActivity() {
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
val anime = intent.getBooleanExtra("anime", true)
|
val anime = intent.getBooleanExtra("anime", true)
|
||||||
binding.listTitle.text =
|
binding.listTitle.text = getString(R.string.user_list, intent.getStringExtra("username"),
|
||||||
intent.getStringExtra("username") + "'s " + (if (anime) "Anime" else "Manga") + " List"
|
if (anime) getString(R.string.anime) else getString(R.string.manga))
|
||||||
binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
binding.listTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||||
this@ListActivity.selectedTabIdx = tab?.position ?: 0
|
this@ListActivity.selectedTabIdx = tab?.position ?: 0
|
||||||
|
|
|
@ -49,7 +49,6 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
|
||||||
private var selected: Int = 0
|
private var selected: Int = 0
|
||||||
private lateinit var navBar: AnimatedBottomBar
|
private lateinit var navBar: AnimatedBottomBar
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
ThemeManager(this).applyTheme()
|
ThemeManager(this).applyTheme()
|
||||||
|
@ -113,20 +112,30 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
|
||||||
val userLevel = intent.getStringExtra("userLVL") ?: ""
|
val userLevel = intent.getStringExtra("userLVL") ?: ""
|
||||||
binding.followButton.visibility =
|
binding.followButton.visibility =
|
||||||
if (user.id == Anilist.userid || Anilist.userid == null) View.GONE else View.VISIBLE
|
if (user.id == Anilist.userid || Anilist.userid == null) View.GONE else View.VISIBLE
|
||||||
binding.followButton.text =
|
binding.followButton.text = getString(
|
||||||
if (user.isFollowing) "Unfollow" else if (user.isFollower) "Follows you" else "Follow"
|
when {
|
||||||
if (user.isFollowing && user.isFollower) binding.followButton.text = "Mutual"
|
user.isFollowing -> R.string.unfollow
|
||||||
|
user.isFollower -> R.string.follows_you
|
||||||
|
else -> R.string.follow
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (user.isFollowing && user.isFollower) binding.followButton.text = getString(R.string.mutual)
|
||||||
binding.followButton.setOnClickListener {
|
binding.followButton.setOnClickListener {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val res = Anilist.query.toggleFollow(user.id)
|
val res = Anilist.query.toggleFollow(user.id)
|
||||||
if (res?.data?.toggleFollow != null) {
|
if (res?.data?.toggleFollow != null) {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
snackString("Success")
|
snackString(R.string.success)
|
||||||
user.isFollowing = res.data.toggleFollow.isFollowing
|
user.isFollowing = res.data.toggleFollow.isFollowing
|
||||||
binding.followButton.text =
|
binding.followButton.text = getString(
|
||||||
if (user.isFollowing) "Unfollow" else if (user.isFollower) "Follows you" else "Follow"
|
when {
|
||||||
if (user.isFollowing && user.isFollower) binding.followButton.text =
|
user.isFollowing -> R.string.unfollow
|
||||||
"Mutual"
|
user.isFollower -> R.string.follows_you
|
||||||
|
else -> R.string.follow
|
||||||
|
}
|
||||||
|
)
|
||||||
|
if (user.isFollowing && user.isFollower)
|
||||||
|
binding.followButton.text = getString(R.string.mutual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -180,7 +189,8 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.profileUserName.text = "${user.name} $userLevel"
|
val userLevelText = "${user.name} $userLevel"
|
||||||
|
binding.profileUserName.text = userLevelText
|
||||||
if (!(PrefManager.getVal(PrefName.BannerAnimations) as Boolean)) binding.profileBannerImage.pause()
|
if (!(PrefManager.getVal(PrefName.BannerAnimations) as Boolean)) binding.profileBannerImage.pause()
|
||||||
blurImage(binding.profileBannerImage, user.bannerImage ?: user.avatar?.medium)
|
blurImage(binding.profileBannerImage, user.bannerImage ?: user.avatar?.medium)
|
||||||
binding.profileBannerImage.updateLayoutParams { height += statusBarHeight }
|
binding.profileBannerImage.updateLayoutParams { height += statusBarHeight }
|
||||||
|
@ -204,7 +214,7 @@ class ProfileActivity : AppCompatActivity(), AppBarLayout.OnOffsetChangedListene
|
||||||
ContextCompat.startActivity(
|
ContextCompat.startActivity(
|
||||||
this@ProfileActivity,
|
this@ProfileActivity,
|
||||||
Intent(this@ProfileActivity, FollowActivity::class.java)
|
Intent(this@ProfileActivity, FollowActivity::class.java)
|
||||||
.putExtra("title", "Followers")
|
.putExtra("title", getString(R.string.followers))
|
||||||
.putExtra("userId", user.id),
|
.putExtra("userId", user.id),
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,7 +39,6 @@ class ActivityItem(
|
||||||
private lateinit var binding: ItemActivityBinding
|
private lateinit var binding: ItemActivityBinding
|
||||||
private lateinit var repliesAdapter: GroupieAdapter
|
private lateinit var repliesAdapter: GroupieAdapter
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun bind(viewBinding: ItemActivityBinding, position: Int) {
|
override fun bind(viewBinding: ItemActivityBinding, position: Int) {
|
||||||
binding = viewBinding
|
binding = viewBinding
|
||||||
setAnimation(binding.root.context, binding.root)
|
setAnimation(binding.root.context, binding.root)
|
||||||
|
@ -73,13 +72,13 @@ class ActivityItem(
|
||||||
} ?: emptyList()
|
} ?: emptyList()
|
||||||
repliesAdapter.addAll(replyItems)
|
repliesAdapter.addAll(replyItems)
|
||||||
binding.activityReplies.visibility = View.VISIBLE
|
binding.activityReplies.visibility = View.VISIBLE
|
||||||
binding.commentTotalReplies.text = "Hide replies"
|
binding.commentTotalReplies.setText(R.string.hide_replies)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
repliesAdapter.clear()
|
repliesAdapter.clear()
|
||||||
binding.activityReplies.visibility = View.GONE
|
binding.activityReplies.visibility = View.GONE
|
||||||
binding.commentTotalReplies.text = "View replies"
|
binding.commentTotalReplies.setText(R.string.view_replies)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +126,9 @@ class ActivityItem(
|
||||||
binding.activityContent.visibility = View.GONE
|
binding.activityContent.visibility = View.GONE
|
||||||
binding.activityBannerContainer.visibility = View.VISIBLE
|
binding.activityBannerContainer.visibility = View.VISIBLE
|
||||||
binding.activityMediaName.text = activity.media?.title?.userPreferred
|
binding.activityMediaName.text = activity.media?.title?.userPreferred
|
||||||
binding.activityText.text = "${activity.user!!.name} ${activity.status} ${activity.progress ?: activity.media?.title?.userPreferred}"
|
val activityText = "${activity.user!!.name} ${activity.status} ${activity.progress
|
||||||
|
?: activity.media?.title?.userPreferred}"
|
||||||
|
binding.activityText.text = activityText
|
||||||
binding.activityCover.loadImage(cover)
|
binding.activityCover.loadImage(cover)
|
||||||
blurImage(binding.activityBannerImage, banner ?: cover)
|
blurImage(binding.activityBannerImage, banner ?: cover)
|
||||||
binding.activityAvatarContainer.setOnClickListener {
|
binding.activityAvatarContainer.setOnClickListener {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import androidx.core.view.isVisible
|
||||||
import androidx.core.view.updateLayoutParams
|
import androidx.core.view.updateLayoutParams
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
|
import ani.dantotsu.R
|
||||||
import ani.dantotsu.connections.anilist.Anilist
|
import ani.dantotsu.connections.anilist.Anilist
|
||||||
import ani.dantotsu.connections.anilist.api.Notification
|
import ani.dantotsu.connections.anilist.api.Notification
|
||||||
import ani.dantotsu.databinding.ActivityFollowBinding
|
import ani.dantotsu.databinding.ActivityFollowBinding
|
||||||
|
@ -37,14 +38,14 @@ class NotificationActivity : AppCompatActivity() {
|
||||||
private var currentPage: Int = 1
|
private var currentPage: Int = 1
|
||||||
private var hasNextPage: Boolean = true
|
private var hasNextPage: Boolean = true
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
ThemeManager(this).applyTheme()
|
ThemeManager(this).applyTheme()
|
||||||
initActivity(this)
|
initActivity(this)
|
||||||
binding = ActivityFollowBinding.inflate(layoutInflater)
|
binding = ActivityFollowBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
binding.listTitle.text = "Notifications"
|
binding.listTitle.text = getString(R.string.notifications)
|
||||||
binding.listToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
binding.listToolbar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
topMargin = statusBarHeight
|
topMargin = statusBarHeight
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ import com.google.android.material.tabs.TabLayoutMediator
|
||||||
class ExtensionsActivity : AppCompatActivity() {
|
class ExtensionsActivity : AppCompatActivity() {
|
||||||
lateinit var binding: ActivityExtensionsBinding
|
lateinit var binding: ActivityExtensionsBinding
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
|
@ -294,13 +294,13 @@ class InstalledAnimeExtensionsFragment : Fragment(), SearchQueryHandler {
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val extension = getItem(position)
|
val extension = getItem(position)
|
||||||
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
||||||
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
||||||
holder.extensionNameTextView.text = extension.name
|
holder.extensionNameTextView.text = extension.name
|
||||||
holder.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw"
|
val versionText = "$lang ${extension.versionName} $nsfw"
|
||||||
|
holder.extensionVersionTextView.text = versionText
|
||||||
if (!skipIcons) {
|
if (!skipIcons) {
|
||||||
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,13 +290,14 @@ class InstalledMangaExtensionsFragment : Fragment(), SearchQueryHandler {
|
||||||
MangaSources.performReorderMangaSources()
|
MangaSources.performReorderMangaSources()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n", "ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val extension = getItem(position) // Use getItem() from ListAdapter
|
val extension = getItem(position) // Use getItem() from ListAdapter
|
||||||
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
||||||
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
||||||
holder.extensionNameTextView.text = extension.name
|
holder.extensionNameTextView.text = extension.name
|
||||||
holder.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw"
|
val versionText = "$lang ${extension.versionName} $nsfw"
|
||||||
|
holder.extensionVersionTextView.text = versionText
|
||||||
if (!skipIcons) {
|
if (!skipIcons) {
|
||||||
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,13 +221,13 @@ class InstalledNovelExtensionsFragment : Fragment(), SearchQueryHandler {
|
||||||
return ViewHolder(view)
|
return ViewHolder(view)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val extension = getItem(position) // Use getItem() from ListAdapter
|
val extension = getItem(position) // Use getItem() from ListAdapter
|
||||||
val nsfw = ""
|
val nsfw = ""
|
||||||
val lang = LanguageMapper.mapLanguageCodeToName("all")
|
val lang = LanguageMapper.mapLanguageCodeToName("all")
|
||||||
holder.extensionNameTextView.text = extension.name
|
holder.extensionNameTextView.text = extension.name
|
||||||
holder.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw"
|
val versionText = "$lang ${extension.versionName} $nsfw"
|
||||||
|
holder.extensionVersionTextView.text = versionText
|
||||||
if (!skipIcons) {
|
if (!skipIcons) {
|
||||||
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
holder.extensionIconImageView.setImageDrawable(extension.icon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,9 +340,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
|
|
||||||
bindingAnime.purgeAnimeDownloads.setOnClickListener {
|
bindingAnime.purgeAnimeDownloads.setOnClickListener {
|
||||||
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
||||||
.setTitle("Purge Anime Downloads")
|
.setTitle(R.string.purge_anime_downloads)
|
||||||
.setMessage("Are you sure you want to purge all anime downloads?")
|
.setMessage(getString(R.string.purge_confirm, getString(R.string.anime)))
|
||||||
.setPositiveButton("Yes") { dialog, _ ->
|
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||||
downloadsManager.purgeDownloads(DownloadedType.Type.ANIME)
|
downloadsManager.purgeDownloads(DownloadedType.Type.ANIME)
|
||||||
DownloadService.sendRemoveAllDownloads(
|
DownloadService.sendRemoveAllDownloads(
|
||||||
|
@ -362,9 +362,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
|
|
||||||
bindingManga.purgeMangaDownloads.setOnClickListener {
|
bindingManga.purgeMangaDownloads.setOnClickListener {
|
||||||
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
||||||
.setTitle("Purge Manga Downloads")
|
.setTitle(R.string.purge_manga_downloads)
|
||||||
.setMessage("Are you sure you want to purge all manga downloads?")
|
.setMessage(getString(R.string.purge_confirm, getString(R.string.manga)))
|
||||||
.setPositiveButton("Yes") { dialog, _ ->
|
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||||
downloadsManager.purgeDownloads(DownloadedType.Type.MANGA)
|
downloadsManager.purgeDownloads(DownloadedType.Type.MANGA)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
@ -379,9 +379,9 @@ class SettingsActivity : AppCompatActivity(), SimpleDialog.OnDialogResultListene
|
||||||
|
|
||||||
bindingManga.purgeNovelDownloads.setOnClickListener {
|
bindingManga.purgeNovelDownloads.setOnClickListener {
|
||||||
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
val dialog = AlertDialog.Builder(this, R.style.MyPopup)
|
||||||
.setTitle("Purge Novel Downloads")
|
.setTitle(R.string.purge_novel_downloads)
|
||||||
.setMessage("Are you sure you want to purge all novel downloads?")
|
.setMessage(getString(R.string.purge_confirm, getString(R.string.novels)))
|
||||||
.setPositiveButton("Yes") { dialog, _ ->
|
.setPositiveButton(R.string.yes) { dialog, _ ->
|
||||||
val downloadsManager = Injekt.get<DownloadsManager>()
|
val downloadsManager = Injekt.get<DownloadsManager>()
|
||||||
downloadsManager.purgeDownloads(DownloadedType.Type.NOVEL)
|
downloadsManager.purgeDownloads(DownloadedType.Type.NOVEL)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
|
|
|
@ -202,12 +202,12 @@ class AnimeExtensionAdapter(private val clickListener: OnAnimeInstallClickListen
|
||||||
|
|
||||||
val extensionIconImageView: ImageView = binding.extensionIconImageView
|
val extensionIconImageView: ImageView = binding.extensionIconImageView
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun bind(extension: AnimeExtension.Available) {
|
fun bind(extension: AnimeExtension.Available) {
|
||||||
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
||||||
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
||||||
binding.extensionNameTextView.text = extension.name
|
binding.extensionNameTextView.text = extension.name
|
||||||
binding.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw"
|
val versionText = "$lang ${extension.versionName} $nsfw"
|
||||||
|
binding.extensionVersionTextView.text = versionText
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear() {
|
fun clear() {
|
||||||
|
|
|
@ -199,12 +199,12 @@ class MangaExtensionAdapter(private val clickListener: OnMangaInstallClickListen
|
||||||
|
|
||||||
val extensionIconImageView: ImageView = binding.extensionIconImageView
|
val extensionIconImageView: ImageView = binding.extensionIconImageView
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
|
||||||
fun bind(extension: MangaExtension.Available) {
|
fun bind(extension: MangaExtension.Available) {
|
||||||
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
val nsfw = if (extension.isNsfw) "(18+)" else ""
|
||||||
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
val lang = LanguageMapper.mapLanguageCodeToName(extension.lang)
|
||||||
binding.extensionNameTextView.text = extension.name
|
binding.extensionNameTextView.text = extension.name
|
||||||
binding.extensionVersionTextView.text = "$lang ${extension.versionName} $nsfw"
|
val versionText = "$lang ${extension.versionName} $nsfw"
|
||||||
|
binding.extensionVersionTextView.text = versionText
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clear() {
|
fun clear() {
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<string name="browse_anime">Browse Anime</string>
|
<string name="browse_anime">Browse Anime</string>
|
||||||
<string name="manga">Manga</string>
|
<string name="manga">Manga</string>
|
||||||
<string name="browse_manga">Browse Manga</string>
|
<string name="browse_manga">Browse Manga</string>
|
||||||
|
<string name="novels">Novels</string>
|
||||||
<string name="info">Info</string>
|
<string name="info">Info</string>
|
||||||
<string name="watch">Watch</string>
|
<string name="watch">Watch</string>
|
||||||
<string name="read">Read</string>
|
<string name="read">Read</string>
|
||||||
|
@ -71,6 +72,9 @@
|
||||||
<item>All</item>
|
<item>All</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string name="no_notifications">No more notifications</string>
|
||||||
|
<string name="followers">Followers</string>
|
||||||
|
|
||||||
<string name="status">STATUS</string>
|
<string name="status">STATUS</string>
|
||||||
<string-array name="status" translatable="false">
|
<string-array name="status" translatable="false">
|
||||||
<item>PLANNING</item>
|
<item>PLANNING</item>
|
||||||
|
@ -111,6 +115,9 @@
|
||||||
<string name="format">Format</string>
|
<string name="format">Format</string>
|
||||||
<string name="status_title">Status</string>
|
<string name="status_title">Status</string>
|
||||||
<string name="total_eps">Total Episodes</string>
|
<string name="total_eps">Total Episodes</string>
|
||||||
|
<string name="episodes"> Episode(s)</string>
|
||||||
|
<string name="chapters"> Chapter(s)</string>
|
||||||
|
<string name="total_divider"> | %1$s</string>
|
||||||
<string name="total_chaps">Total Chapters</string>
|
<string name="total_chaps">Total Chapters</string>
|
||||||
<string name="ep_duration">Average Duration</string>
|
<string name="ep_duration">Average Duration</string>
|
||||||
<string name="min">" min"</string>
|
<string name="min">" min"</string>
|
||||||
|
@ -392,7 +399,6 @@
|
||||||
<string name="subscriptions_info">Amount of time for Dantotsu to periodically check for new Episodes/Chapters\n(Less time will cause more battery consumption)</string>
|
<string name="subscriptions_info">Amount of time for Dantotsu to periodically check for new Episodes/Chapters\n(Less time will cause more battery consumption)</string>
|
||||||
<string name="do_not_update">Don\'t Update</string>
|
<string name="do_not_update">Don\'t Update</string>
|
||||||
<string name="loading_next_chap">Loading Next Chapter</string>
|
<string name="loading_next_chap">Loading Next Chapter</string>
|
||||||
<string name="grid">Grid</string>
|
|
||||||
<string name="sort_by_release_date">Sort by Release Date</string>
|
<string name="sort_by_release_date">Sort by Release Date</string>
|
||||||
<string name="crop_borders">Crop Borders</string>
|
<string name="crop_borders">Crop Borders</string>
|
||||||
<string name="note">NOTE</string>
|
<string name="note">NOTE</string>
|
||||||
|
@ -490,14 +496,16 @@
|
||||||
<string name="read_on_dantotsu">Read on Dantotsu</string>
|
<string name="read_on_dantotsu">Read on Dantotsu</string>
|
||||||
<string name="watch_on_dantotsu">Watch on Dantotsu</string>
|
<string name="watch_on_dantotsu">Watch on Dantotsu</string>
|
||||||
<string name="view_profile_in_dantotsu">View Profile in Dantotsu</string>
|
<string name="view_profile_in_dantotsu">View Profile in Dantotsu</string>
|
||||||
<string name="continue_episode">"Continue : Episode "</string>
|
<string name="continue_episode">Continue : Episode %1$s%2$s\n%3$s</string>
|
||||||
<string name="continue_chapter">"Continue : "</string>
|
<string name="filler_tag"> - Filler</string>
|
||||||
|
<string name="continue_chapter">Continue : %1$s\n%2$s</string>
|
||||||
<string name="episode">"Episode "</string>
|
<string name="episode">"Episode "</string>
|
||||||
<string name="episode_num">"Episode %1$s"</string>
|
<string name="episode_num">"Episode %1$s"</string>
|
||||||
<string name="chapter">"Chapter "</string>
|
<string name="chapter">"Chapter "</string>
|
||||||
<string name="chapter_num">"Chapter %1$s"</string>
|
<string name="chapter_num">"Chapter %1$s"</string>
|
||||||
<string name="just_released">- just got released!</string>
|
<string name="just_released">- just got released!</string>
|
||||||
<string name="checking_subscriptions_title">Checking Subscriptions</string>
|
<string name="checking_subscriptions_title">Checking Subscriptions</string>
|
||||||
|
<string name="user_list">%1$s\'s %2$s List</string>
|
||||||
|
|
||||||
<string name="speed">Speed</string>
|
<string name="speed">Speed</string>
|
||||||
<string name="auto_update">Auto Update progress for %1$s?</string>
|
<string name="auto_update">Auto Update progress for %1$s?</string>
|
||||||
|
@ -657,7 +665,7 @@
|
||||||
<string name="app_widget_description">This is an app widget description</string>
|
<string name="app_widget_description">This is an app widget description</string>
|
||||||
<string name="airing_image">Airing Image</string>
|
<string name="airing_image">Airing Image</string>
|
||||||
<string name="anime_downloads">animeDownloads</string>
|
<string name="anime_downloads">animeDownloads</string>
|
||||||
<string name="purge_anime_downloads">Delete all anime downloads</string>
|
<string name="purge_anime_downloads">Delete all Anime downloads</string>
|
||||||
<string name="purge_manga_downloads">Delete all Manga Downloads</string>
|
<string name="purge_manga_downloads">Delete all Manga Downloads</string>
|
||||||
<string name="purge_novel_downloads">Delete all Novel Downloads</string>
|
<string name="purge_novel_downloads">Delete all Novel Downloads</string>
|
||||||
<string name="requires_android_12">Requires Android 12+</string>
|
<string name="requires_android_12">Requires Android 12+</string>
|
||||||
|
@ -690,6 +698,10 @@
|
||||||
<string name="manga_mean_score">Manga Mean Score</string>
|
<string name="manga_mean_score">Manga Mean Score</string>
|
||||||
<string name="about_me">About me</string>
|
<string name="about_me">About me</string>
|
||||||
<string name="follow">Follow</string>
|
<string name="follow">Follow</string>
|
||||||
|
<string name="unfollow">Unfollow</string>
|
||||||
|
<string name="follows_you">Follows you</string>
|
||||||
|
<string name="mutual">Mutual</string>
|
||||||
|
<string name="success">Success</string>
|
||||||
<string name="lorem_ipsum">
|
<string name="lorem_ipsum">
|
||||||
|
|
||||||
Lorem ipsum dolor sit amet. Est consectetur sint qui internos optio nam Quis excepturi qui voluptatem animi. Qui labore quasi vel suscipit deleniti et doloremque omnis in velit suscipit et quasi eaque. Et doloribus recusandae id laudantium Quis qui natus velit in voluptatem voluptatem!
|
Lorem ipsum dolor sit amet. Est consectetur sint qui internos optio nam Quis excepturi qui voluptatem animi. Qui labore quasi vel suscipit deleniti et doloremque omnis in velit suscipit et quasi eaque. Et doloribus recusandae id laudantium Quis qui natus velit in voluptatem voluptatem!
|
||||||
|
@ -710,4 +722,36 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
|
||||||
<string name="anilist_notifications_checking_time">Anilist notifications update frequency : %1$s</string>
|
<string name="anilist_notifications_checking_time">Anilist notifications update frequency : %1$s</string>
|
||||||
<string name="comment_notification_checking_time">Comment notifications update frequency : %1$s</string>
|
<string name="comment_notification_checking_time">Comment notifications update frequency : %1$s</string>
|
||||||
<string name="activities">Activities</string>
|
<string name="activities">Activities</string>
|
||||||
|
|
||||||
|
<string name="purge_confirm">Are you sure you want to purge all %1$s downloads?</string>
|
||||||
|
|
||||||
|
<string name="delete_fail_reason">Failed to delete because of… %1$s</string>
|
||||||
|
|
||||||
|
<string name="hide_replies">Hide replies</string>
|
||||||
|
<string name="view_reply">View reply</string>
|
||||||
|
<string name="view_replies">View replies</string>
|
||||||
|
<string name="view_replies_count">View %1$d replies</string>
|
||||||
|
<string name="replying_to">Replying to %1$s</string>
|
||||||
|
|
||||||
|
<string name="delete_comment">Delete Comment</string>
|
||||||
|
<string name="delete_comment_confirm">Are you sure you want to delete this comment?</string>
|
||||||
|
<string name="comment_deleted">Comment Deleted</string>
|
||||||
|
|
||||||
|
<string name="ban_user">Ban User</string>
|
||||||
|
<string name="ban_user_confirm">Are you sure you want to ban this user?</string>
|
||||||
|
<string name="user_banned">User Banned</string>
|
||||||
|
|
||||||
|
<string name="report_comment">Report Comment</string>
|
||||||
|
<string name="report_comment_confirm">Only report comments that violate the rules. Are you sure you want to report this comment?</string>
|
||||||
|
<string name="comment_reported">Comment Reported</string>
|
||||||
|
|
||||||
|
<string name="list">List</string>
|
||||||
|
<string name="grid">Grid</string>
|
||||||
|
<string name="compact">Compact</string>
|
||||||
|
|
||||||
|
<string name="webview_not_installed">WebView not installed</string>
|
||||||
|
|
||||||
|
<string name="video_quality">Quality: %1$dp</string>
|
||||||
|
<string name="size_unknown">Unknown Size</string>
|
||||||
|
<string name="mb_size">%1$s MB</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
2
lint.xml
2
lint.xml
|
@ -2,4 +2,6 @@
|
||||||
<lint>
|
<lint>
|
||||||
<issue id="InlinedApi" severity="error" />
|
<issue id="InlinedApi" severity="error" />
|
||||||
<issue id="NewApi" severity="error" />
|
<issue id="NewApi" severity="error" />
|
||||||
|
<issue id="SetTextI18n" severity="error" />
|
||||||
|
<issue id="HardcodedText" severity="error" />
|
||||||
</lint>
|
</lint>
|
Loading…
Add table
Add a link
Reference in a new issue