Merge branch 'dev' of https://github.com/rebelonion/Dantotsu into dev
This commit is contained in:
commit
126fe75c46
8 changed files with 105 additions and 35 deletions
|
@ -232,9 +232,9 @@ class HomeFragment : Fragment() {
|
|||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
more.setOnClickListener { _ ->
|
||||
more.setOnClickListener { i ->
|
||||
ContextCompat.startActivity(
|
||||
requireActivity(), Intent(requireActivity(), MediaListViewActivity::class.java)
|
||||
i.context, Intent(i.context, MediaListViewActivity::class.java)
|
||||
.putExtra("title", string)
|
||||
.putExtra("media", it),
|
||||
null
|
||||
|
|
|
@ -221,7 +221,6 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
|||
media
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun updateTopRated(adaptor: MediaAdaptor, media: MutableList<Media>) {
|
||||
|
@ -254,7 +253,15 @@ class MangaPageAdapter : RecyclerView.Adapter<MangaPageAdapter.MangaPageViewHold
|
|||
}
|
||||
}
|
||||
|
||||
fun init(adaptor: MediaAdaptor, recyclerView: RecyclerView, progress: View, title: View , more: View , string: String, media : MutableList<Media>) {
|
||||
fun init(
|
||||
adaptor: MediaAdaptor,
|
||||
recyclerView: RecyclerView,
|
||||
progress: View,
|
||||
title: View ,
|
||||
more: View ,
|
||||
string: String,
|
||||
media : MutableList<Media>
|
||||
) {
|
||||
progress.visibility = View.GONE
|
||||
recyclerView.adapter = adaptor
|
||||
recyclerView.layoutManager =
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ani.dantotsu.media
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.Window
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
@ -52,11 +53,36 @@ class MediaListViewActivity: AppCompatActivity() {
|
|||
binding.listTitle.setTextColor(primaryTextColor)
|
||||
val screenWidth = resources.displayMetrics.run { widthPixels / density }
|
||||
val mediaList = intent.getSerialized("media") as? ArrayList<Media> ?: ArrayList()
|
||||
val view = PrefManager.getCustomVal("mediaView", 0)
|
||||
var mediaView: View = when (view) {
|
||||
1 -> binding.mediaList
|
||||
0 -> binding.mediaGrid
|
||||
else -> binding.mediaGrid
|
||||
}
|
||||
mediaView.alpha = 1f
|
||||
fun changeView(mode: Int, current: View) {
|
||||
mediaView.alpha = 0.33f
|
||||
mediaView = current
|
||||
current.alpha = 1f
|
||||
PrefManager.setCustomVal("mediaView", mode)
|
||||
binding.mediaRecyclerView.adapter = MediaAdaptor(mode, mediaList, this)
|
||||
binding.mediaRecyclerView.layoutManager = GridLayoutManager(
|
||||
this,
|
||||
if (mode == 1) 1 else (screenWidth / 120f).toInt()
|
||||
)
|
||||
}
|
||||
binding.mediaList.setOnClickListener {
|
||||
changeView(1, binding.mediaList)
|
||||
}
|
||||
binding.mediaGrid.setOnClickListener {
|
||||
changeView(0, binding.mediaGrid)
|
||||
}
|
||||
|
||||
binding.listTitle.text = intent.getStringExtra("title")
|
||||
binding.mediaRecyclerView.adapter = MediaAdaptor(0, mediaList, this)
|
||||
binding.mediaRecyclerView.adapter = MediaAdaptor(view, mediaList, this)
|
||||
binding.mediaRecyclerView.layoutManager = GridLayoutManager(
|
||||
this,
|
||||
(screenWidth / 120f).toInt()
|
||||
if (view == 1) 1 else (screenWidth / 120f).toInt()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,34 +3,45 @@ package ani.dantotsu.others
|
|||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.Button
|
||||
import android.widget.EditText
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import ani.dantotsu.R
|
||||
import ani.dantotsu.databinding.ActivityCrashBinding
|
||||
import ani.dantotsu.initActivity
|
||||
import ani.dantotsu.navBarHeight
|
||||
import ani.dantotsu.statusBarHeight
|
||||
import ani.dantotsu.themes.ThemeManager
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import java.io.File
|
||||
|
||||
|
||||
class CrashActivity : AppCompatActivity() {
|
||||
private lateinit var binding: ActivityCrashBinding
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_crash)
|
||||
ThemeManager(this).applyTheme()
|
||||
initActivity(this)
|
||||
binding = ActivityCrashBinding.inflate(layoutInflater)
|
||||
|
||||
setContentView(binding.root)
|
||||
binding.root.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||
topMargin = statusBarHeight
|
||||
bottomMargin = navBarHeight
|
||||
}
|
||||
val stackTrace = intent.getStringExtra("stackTrace") ?: "No stack trace available"
|
||||
val reportView = findViewById<EditText>(R.id.crashReportView)
|
||||
reportView.setText(stackTrace)
|
||||
reportView.setOnKeyListener(View.OnKeyListener { _, _, _ ->
|
||||
|
||||
binding.crashReportView.setText(stackTrace)
|
||||
binding.crashReportView.setOnKeyListener(View.OnKeyListener { _, _, _ ->
|
||||
true // Blocks input from hardware keyboards.
|
||||
})
|
||||
|
||||
val copyButton = findViewById<Button>(R.id.copyButton)
|
||||
copyButton.setOnClickListener {
|
||||
binding.copyButton.setOnClickListener {
|
||||
copyToClipboard("Crash log", stackTrace)
|
||||
}
|
||||
|
||||
val shareAsTextFileButton = findViewById<Button>(R.id.shareAsTextFileButton)
|
||||
shareAsTextFileButton.setOnClickListener {
|
||||
binding.shareAsTextFileButton.setOnClickListener {
|
||||
shareAsTextFile(stackTrace)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue