Change GalleryActivity to ReaderActivity

This commit is contained in:
tom5079
2019-05-14 03:58:22 +09:00
parent a7ecaa8ca7
commit 2acfd3c57c
4 changed files with 16 additions and 16 deletions

View File

@@ -25,7 +25,7 @@
android:resource="@xml/filepaths"/> android:resource="@xml/filepaths"/>
</provider> </provider>
<activity android:name=".GalleryActivity" <activity android:name=".ReaderActivity"
android:configChanges="keyboardHidden|orientation|screenSize"/> android:configChanges="keyboardHidden|orientation|screenSize"/>
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"

View File

@@ -270,7 +270,7 @@ class MainActivity : AppCompatActivity() {
with(main_recyclerview) { with(main_recyclerview) {
adapter = GalleryBlockAdapter(galleries).apply { adapter = GalleryBlockAdapter(galleries).apply {
setClickListener { galleryID, title -> setClickListener { galleryID, title ->
val intent = Intent(this@MainActivity, GalleryActivity::class.java) val intent = Intent(this@MainActivity, ReaderActivity::class.java)
intent.putExtra("GALLERY_ID", galleryID) intent.putExtra("GALLERY_ID", galleryID)
intent.putExtra("GALLERY_TITLE", title) intent.putExtra("GALLERY_TITLE", title)

View File

@@ -7,7 +7,7 @@ import android.view.View
import android.view.WindowManager import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.preference.PreferenceManager import androidx.preference.PreferenceManager
import kotlinx.android.synthetic.main.activity_gallery.* import kotlinx.android.synthetic.main.activity_reader.*
import kotlinx.coroutines.* import kotlinx.coroutines.*
import xyz.quaver.hitomi.Reader import xyz.quaver.hitomi.Reader
import xyz.quaver.hitomi.getReader import xyz.quaver.hitomi.getReader
@@ -18,7 +18,7 @@ import java.io.FileOutputStream
import java.net.URL import java.net.URL
import javax.net.ssl.HttpsURLConnection import javax.net.ssl.HttpsURLConnection
class GalleryActivity : AppCompatActivity() { class ReaderActivity : AppCompatActivity() {
private val images = ArrayList<String>() private val images = ArrayList<String>()
private var galleryID = 0 private var galleryID = 0
@@ -34,7 +34,7 @@ class GalleryActivity : AppCompatActivity() {
WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE,
WindowManager.LayoutParams.FLAG_SECURE) WindowManager.LayoutParams.FLAG_SECURE)
setContentView(R.layout.activity_gallery) setContentView(R.layout.activity_reader)
supportActionBar?.title = intent.getStringExtra("GALLERY_TITLE") supportActionBar?.title = intent.getStringExtra("GALLERY_TITLE")
@@ -42,7 +42,7 @@ class GalleryActivity : AppCompatActivity() {
CoroutineScope(Dispatchers.Unconfined).launch { CoroutineScope(Dispatchers.Unconfined).launch {
reader = async(Dispatchers.IO) { reader = async(Dispatchers.IO) {
Log.d("Pupil", "Loading reader") Log.d("Pupil", "Loading reader")
val preference = PreferenceManager.getDefaultSharedPreferences(this@GalleryActivity) val preference = PreferenceManager.getDefaultSharedPreferences(this@ReaderActivity)
if (preference.getBoolean("use_hiyobi", false)) { if (preference.getBoolean("use_hiyobi", false)) {
try { try {
xyz.quaver.hiyobi.getReader(galleryID) xyz.quaver.hiyobi.getReader(galleryID)
@@ -82,7 +82,7 @@ class GalleryActivity : AppCompatActivity() {
} }
private fun initView() { private fun initView() {
gallery_recyclerview.adapter = GalleryAdapter(images).apply { reader_recyclerview.adapter = GalleryAdapter(images).apply {
setOnClick { setOnClick {
val attrs = window.attributes val attrs = window.attributes
@@ -113,7 +113,7 @@ class GalleryActivity : AppCompatActivity() {
Log.d("Pupil", "Reader Data recieved") Log.d("Pupil", "Reader Data recieved")
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
with(gallery_progressbar) { with(reader_progressbar) {
max = reader.size max = reader.size
progress = 0 progress = 0
@@ -151,14 +151,14 @@ class GalleryActivity : AppCompatActivity() {
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
images.add(cache) images.add(cache)
gallery_recyclerview.adapter?.notifyItemInserted(images.size - 1) reader_recyclerview.adapter?.notifyItemInserted(images.size - 1)
gallery_progressbar.progress++ reader_progressbar.progress++
} }
} }
} }
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
gallery_progressbar.visibility = View.GONE reader_progressbar.visibility = View.GONE
} }
} }
} }

View File

@@ -4,15 +4,15 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".GalleryActivity"> tools:context=".ReaderActivity">
<FrameLayout <FrameLayout
android:id="@+id/gallery_framelayout" android:id="@+id/reader_framelayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="4dp"> android:layout_height="4dp">
<ProgressBar <ProgressBar
android:id="@+id/gallery_progressbar" android:id="@+id/reader_progressbar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal" style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="4dp" android:layout_height="4dp"
@@ -21,10 +21,10 @@
</FrameLayout> </FrameLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/gallery_recyclerview" android:id="@+id/reader_recyclerview"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_below="@id/gallery_framelayout" android:layout_below="@id/reader_framelayout"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/> app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
</RelativeLayout> </RelativeLayout>