Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tom5079 committed Sep 14, 2020
2 parents 265473a + 4207ea4 commit 6903382
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 42 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
minSdkVersion 16
targetSdkVersion 30
versionCode 59
versionName "5.0.3"
versionName "5.0.3-hotfix1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"filters": [],
"properties": [],
"versionCode": 59,
"versionName": "5.0.3",
"versionName": "5.0.3-hotfix1",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
26 changes: 7 additions & 19 deletions app/src/main/java/xyz/quaver/pupil/ui/ReaderActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ class ReaderActivity : BaseActivity() {
field = value

(reader_recyclerview.adapter as ReaderAdapter).isFullScreen = value

reader_progressbar.visibility = when {
value -> View.VISIBLE
else -> View.GONE
}
}

private lateinit var cache: Cache
Expand Down Expand Up @@ -124,6 +119,7 @@ class ReaderActivity : BaseActivity() {
private var cameraEnabled = false
private var eyeType: Eye? = null
private var eyeCount: Int = 0
private var eyeTime: Long = 0L

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -328,7 +324,6 @@ class ReaderActivity : BaseActivity() {
runOnUiThread {
reader_download_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0
reader_download_progressbar.progress = downloader.progress[galleryID]?.count { it.isInfinite() } ?: 0
reader_progressbar.max = reader_recyclerview.adapter?.itemCount ?: 0

if (title == getString(R.string.reader_loading)) {
val reader = cache.metadata.reader
Expand Down Expand Up @@ -391,7 +386,7 @@ class ReaderActivity : BaseActivity() {
return
currentPage = layoutManager.findFirstVisibleItemPosition()+1
menu?.findItem(R.id.reader_menu_page_indicator)?.title = "$currentPage/${recyclerView.adapter!!.itemCount}"
this@ReaderActivity.reader_progressbar.progress = currentPage

}
})
}
Expand Down Expand Up @@ -492,17 +487,6 @@ class ReaderActivity : BaseActivity() {
} else {
snapHelper.attachToRecyclerView(reader_recyclerview)
reader_recyclerview.layoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, Preferences["rtl", false])

if (Preferences["rtl", false])
with(reader_progressbar) {
scaleX = -1F
translationX = 1F
}
else
with(reader_progressbar) {
scaleX = 0F
translationX = 0F
}
}

(reader_recyclerview.layoutManager as LinearLayoutManager).scrollToPositionWithOffset(currentPage-1, 0)
Expand Down Expand Up @@ -581,24 +565,27 @@ class ReaderActivity : BaseActivity() {
!left.xor(right) -> {
eyeType = null
eyeCount = 0
eyeTime = 0L
}
!left -> {
if (eyeType != Eye.LEFT) {
eyeType = Eye.LEFT
eyeCount = 0
eyeTime = System.currentTimeMillis()
}
eyeCount++
}
!right -> {
if (eyeType != Eye.RIGHT) {
eyeType = Eye.RIGHT
eyeCount = 0
eyeTime = System.currentTimeMillis()
}
eyeCount++
}
}

if (eyeCount > 3) {
if (eyeCount > 3 && System.currentTimeMillis() - eyeTime > 500) {
(this@ReaderActivity.reader_recyclerview.layoutManager as LinearLayoutManager).let {
it.scrollToPositionWithOffset(when(eyeType!!) {
Eye.RIGHT -> {
Expand All @@ -612,6 +599,7 @@ class ReaderActivity : BaseActivity() {

eyeType = null
eyeCount = 0
eyeTime = 0L
}
}

Expand Down
25 changes: 4 additions & 21 deletions app/src/main/res/layout/activity_reader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,11 @@
android:layout_gravity="center_horizontal"
android:layout_margin="8dp"/>

<LinearLayout
<ProgressBar
android:id="@+id/reader_download_progressbar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<ProgressBar
android:id="@+id/reader_download_progressbar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_gravity="center"/>

<ProgressBar
android:id="@+id/reader_progressbar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
android:progressTint="@color/material_green_a700"
tools:ignore="UnusedAttribute"
android:visibility="gone"/>

</LinearLayout>
android:layout_height="4dp"/>

<com.github.clans.fab.FloatingActionMenu
android:id="@+id/reader_fab"
Expand Down

0 comments on commit 6903382

Please sign in to comment.