Skip to content

Commit

Permalink
Fixed fastscroll
Browse files Browse the repository at this point in the history
  • Loading branch information
tom5079 committed Sep 12, 2020
1 parent 3dda2f9 commit 56a9126
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId "xyz.quaver.pupil"
minSdkVersion 16
targetSdkVersion 30
versionCode 58
versionName "5.0-hotfix4"
versionCode 59
versionName "5.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Expand Down
Binary file modified app/libs/recyclerviewfastscroller-release.aar
Binary file not shown.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"properties": [],
"versionCode": 58,
"versionName": "5.0-hotfix4",
"versionCode": 59,
"versionName": "5.0.1",
"enabled": true,
"outputFile": "app-release.apk"
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/xyz/quaver/pupil/ui/ReaderActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat
import com.bumptech.glide.Glide
import com.google.android.material.snackbar.Snackbar
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
import kotlinx.android.synthetic.main.activity_reader.*
import kotlinx.android.synthetic.main.activity_reader.view.*
import kotlinx.android.synthetic.main.dialog_numberpicker.view.*
Expand Down Expand Up @@ -422,10 +423,22 @@ class ReaderActivity : BaseActivity() {
flags = flags or WindowManager.LayoutParams.FLAG_FULLSCREEN
supportActionBar?.hide()
this@ReaderActivity.reader_fab.visibility = View.INVISIBLE
this@ReaderActivity.scroller.let {
it.handleWidth = resources.getDimensionPixelSize(R.dimen.thumb_height)
it.handleHeight = resources.getDimensionPixelSize(R.dimen.thumb_width)
it.handleDrawable = ContextCompat.getDrawable(this@ReaderActivity, R.drawable.thumb_horizontal)
it.fastScrollDirection = RecyclerViewFastScroller.FastScrollDirection.HORIZONTAL
}
} else {
flags = flags and WindowManager.LayoutParams.FLAG_FULLSCREEN.inv()
supportActionBar?.show()
this@ReaderActivity.reader_fab.visibility = View.VISIBLE
this@ReaderActivity.scroller.let {
it.handleWidth = resources.getDimensionPixelSize(R.dimen.thumb_width)
it.handleHeight = resources.getDimensionPixelSize(R.dimen.thumb_height)
it.handleDrawable = ContextCompat.getDrawable(this@ReaderActivity, R.drawable.thumb)
it.fastScrollDirection = RecyclerViewFastScroller.FastScrollDirection.VERTICAL
}
}

window.attributes = this
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/thumb.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--~ Pupil, Hitomi.la viewer for Android ~ Copyright (C) 2020 tom5079 ~ ~ This program is free software: you can redistribute it and/or modify ~ it under the terms of the GNU General Public License as published by ~ the Free Software Foundation, either version 3 of the License, or ~ (at your option) any later version. ~ ~ This program is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU General Public License for more details. ~ ~ You should have received a copy of the GNU General Public License ~ along with this program. If not, see <http://www.gnu.org/licenses/>.-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="64dp" android:height="192dp" android:viewportWidth="64" android:viewportHeight="192">
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="72dp" android:viewportWidth="64" android:viewportHeight="192">
<path android:pathData="M36 0h1l1 1h3l1 1h1l1 1h2l1 1h1l1 1h1l1 1 1 1 1 1 1 1h1v1l1 1 1 1 1 1v1l1 1 1 1v1l1 1v2l1 1v1l1 1v3l1 1v138l-1 1v3l-1 1v1l-1 1v2l-1 1v1l-1 1v1l-1 1-1 1-1 1-1 1v1h-1l-1 1-1 1-1 1-1 1h-1l-1 1h-1l-1 1h-2l-1 1h-1l-1 1h-3l-1 1H27l-1-1h-3l-1-1h-1l-1-1h-2l-1-1h-1l-1-1h-1l-1-1-1-1-1-1-1-1H9v-1l-1-1-1-1-1-1v-1l-1-1-1-1v-1l-1-1v-2l-1-1v-1l-1-1v-3l-1-1V27l1-1v-3l1-1v-1l1-1v-2l1-1v-1l1-1v-1l1-1 1-1 1-1 1-1V9h1l1-1 1-1 1-1 1-1h1l1-1h1l1-1h2l1-1h1l1-1h3l1-1h9z" android:fillColor="#4fc3f7"/>
<path android:fillColor="#FF000000" android:pathData="M42 80L32 70 22 80m20 32l-10 10-10-10" android:strokeWidth="2" android:fillAlpha="0" android:strokeColor="#000"/>
</vector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/thumb_horizontal.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--~ Pupil, Hitomi.la viewer for Android ~ Copyright (C) 2020 tom5079 ~ ~ This program is free software: you can redistribute it and/or modify ~ it under the terms of the GNU General Public License as published by ~ the Free Software Foundation, either version 3 of the License, or ~ (at your option) any later version. ~ ~ This program is distributed in the hope that it will be useful, ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ~ GNU General Public License for more details. ~ ~ You should have received a copy of the GNU General Public License ~ along with this program. If not, see <http://www.gnu.org/licenses/>.-->
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="192dp" android:height="64dp" android:viewportWidth="192" android:viewportHeight="64">
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="72dp" android:height="24dp" android:viewportWidth="192" android:viewportHeight="64">
<path android:pathData="M29 64h-2l-1-1h-3l-1-1h-1l-1-1h-2l-1-1h-1l-1-1h-1l-1-1-1-1-1-1-1-1H9v-1l-1-1-1-1-1-1-1-1v-1l-1-1v-1l-1-1v-2l-1-1v-1l-1-1v-3l-1-1V27l1-1v-3l1-1v-1l1-1v-2l1-1v-1l1-1v-1l1-1 1-1 1-1 1-1V9h1l1-1 1-1 1-1 1-1h1l1-1h1l1-1h2l1-1h1l1-1h3l1-1h138l1 1h3l1 1h1l1 1h2l1 1h1l1 1h1l1 1 1 1 1 1 1 1h1v1l1 1 1 1 1 1 1 1v1l1 1v1l1 1v2l1 1v1l1 1v3l1 1v10l-1 1v3l-1 1v1l-1 1v2l-1 1v1l-1 1v1l-1 1-1 1-1 1-1 1v1h-1l-1 1-1 1-1 1-1 1h-1l-1 1h-1l-1 1h-2l-1 1h-1l-1 1h-3l-1 1H29z" android:fillColor="#4fc3f7"/>
<path android:fillColor="#FF000000" android:pathData="M80 42L70 32l10-10m32 20l10-10-10-10" android:strokeWidth="2" android:fillAlpha="0" android:strokeColor="#000"/>
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_main_content.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
app:handleHasFixedSize="true"
app:handleHeight="72dp"
app:handleWidth="24dp"
app:trackMarginStart="64dp"
app:addLastItemPadding="true"
app:popupDrawable="@color/transparent">

Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_reader.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
tools:context=".ui.ReaderActivity">

<com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
android:id="@+id/scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:fastScrollDirection="horizontal"
app:handleDrawable="@drawable/thumb_horizontal"
app:handleDrawable="@drawable/thumb"
app:handleHeight="72dp"
app:handleWidth="24dp"
app:handleHasFixedSize="true"
app:handleHeight="24dp"
app:handleWidth="72dp"
app:addLastItemPadding="true"
app:popupDrawable="@color/transparent">

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/dimen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@
<dimen name="galleryblock_thumbnail_thin">100dp</dimen>

<dimen name="reader_max_height">2000dp</dimen>

<dimen name="thumb_width">24dp</dimen>
<dimen name="thumb_height">72dp</dimen>
</resources>

0 comments on commit 56a9126

Please sign in to comment.