Reduce priority of jcenter repository

This commit is contained in:
inorichi 2019-03-14 17:32:08 +01:00
parent f8e121ee06
commit 3f2d375a53
13 changed files with 57 additions and 19 deletions

View file

@ -41,6 +41,8 @@ object PreferenceKeys {
const val readWithTapping = "reader_tap" const val readWithTapping = "reader_tap"
const val readWithLongTap = "reader_long_tap"
const val readWithVolumeKeys = "reader_volume_keys" const val readWithVolumeKeys = "reader_volume_keys"
const val readWithVolumeKeysInverted = "reader_volume_keys_inverted" const val readWithVolumeKeysInverted = "reader_volume_keys_inverted"

View file

@ -69,6 +69,8 @@ class PreferencesHelper(val context: Context) {
fun readWithTapping() = rxPrefs.getBoolean(Keys.readWithTapping, true) fun readWithTapping() = rxPrefs.getBoolean(Keys.readWithTapping, true)
fun readWithLongTap() = rxPrefs.getBoolean(Keys.readWithLongTap, true)
fun readWithVolumeKeys() = rxPrefs.getBoolean(Keys.readWithVolumeKeys, false) fun readWithVolumeKeys() = rxPrefs.getBoolean(Keys.readWithVolumeKeys, false)
fun readWithVolumeKeysInverted() = rxPrefs.getBoolean(Keys.readWithVolumeKeysInverted, false) fun readWithVolumeKeysInverted() = rxPrefs.getBoolean(Keys.readWithVolumeKeysInverted, false)

View file

@ -62,6 +62,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
show_page_number.bindToPreference(preferences.showPageNumber()) show_page_number.bindToPreference(preferences.showPageNumber())
fullscreen.bindToPreference(preferences.fullscreen()) fullscreen.bindToPreference(preferences.fullscreen())
keepscreen.bindToPreference(preferences.keepScreenOn()) keepscreen.bindToPreference(preferences.keepScreenOn())
long_tap.bindToPreference(preferences.readWithLongTap())
} }
/** /**

View file

@ -25,7 +25,7 @@ open class Pager(
/** /**
* Long tap listener function to execute when a long tap is detected. * Long tap listener function to execute when a long tap is detected.
*/ */
var longTapListener: ((MotionEvent) -> Unit)? = null var longTapListener: ((MotionEvent) -> Boolean)? = null
/** /**
* Gesture listener that implements tap and long tap events. * Gesture listener that implements tap and long tap events.
@ -38,8 +38,7 @@ open class Pager(
override fun onLongTapConfirmed(ev: MotionEvent) { override fun onLongTapConfirmed(ev: MotionEvent) {
val listener = longTapListener val listener = longTapListener
if (listener != null) { if (listener != null && listener.invoke(ev)) {
listener.invoke(ev)
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
} }
} }

View file

@ -19,6 +19,9 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
var tappingEnabled = true var tappingEnabled = true
private set private set
var longTapEnabled = true
private set
var volumeKeysEnabled = false var volumeKeysEnabled = false
private set private set
@ -44,6 +47,9 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
preferences.readWithTapping() preferences.readWithTapping()
.register({ tappingEnabled = it }) .register({ tappingEnabled = it })
preferences.readWithLongTap()
.register({ longTapEnabled = it })
preferences.pageTransitions() preferences.pageTransitions()
.register({ usePageTransitions = it }) .register({ usePageTransitions = it })

View file

@ -92,12 +92,16 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
else -> activity.toggleMenu() else -> activity.toggleMenu()
} }
} }
pager.longTapListener = { pager.longTapListener = f@ {
if (activity.menuVisible || config.longTapEnabled) {
val item = adapter.items.getOrNull(pager.currentItem) val item = adapter.items.getOrNull(pager.currentItem)
if (item is ReaderPage) { if (item is ReaderPage) {
activity.onPageLongTap(item) activity.onPageLongTap(item)
return@f true
} }
} }
false
}
config.imagePropertyChangedListener = { config.imagePropertyChangedListener = {
refreshAdapter() refreshAdapter()

View file

@ -19,6 +19,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
var tappingEnabled = true var tappingEnabled = true
private set private set
var longTapEnabled = true
private set
var volumeKeysEnabled = false var volumeKeysEnabled = false
private set private set
@ -35,6 +38,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
preferences.readWithTapping() preferences.readWithTapping()
.register({ tappingEnabled = it }) .register({ tappingEnabled = it })
preferences.readWithLongTap()
.register({ longTapEnabled = it })
preferences.cropBordersWebtoon() preferences.cropBordersWebtoon()
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() }) .register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })

View file

@ -37,7 +37,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
private val detector = Detector() private val detector = Detector()
var tapListener: ((MotionEvent) -> Unit)? = null var tapListener: ((MotionEvent) -> Unit)? = null
var longTapListener: ((MotionEvent) -> Unit)? = null var longTapListener: ((MotionEvent) -> Boolean)? = null
override fun onMeasure(widthSpec: Int, heightSpec: Int) { override fun onMeasure(widthSpec: Int, heightSpec: Int) {
halfWidth = MeasureSpec.getSize(widthSpec) / 2 halfWidth = MeasureSpec.getSize(widthSpec) / 2
@ -220,8 +220,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
override fun onLongTapConfirmed(ev: MotionEvent) { override fun onLongTapConfirmed(ev: MotionEvent) {
val listener = longTapListener val listener = longTapListener
if (listener != null) { if (listener != null && listener.invoke(ev)) {
listener.invoke(ev)
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
} }
} }

View file

@ -95,14 +95,18 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
else -> activity.toggleMenu() else -> activity.toggleMenu()
} }
} }
recycler.longTapListener = { event -> recycler.longTapListener = f@ { event ->
if (activity.menuVisible || config.longTapEnabled) {
val child = recycler.findChildViewUnder(event.x, event.y) val child = recycler.findChildViewUnder(event.x, event.y)
val position = recycler.getChildAdapterPosition(child) val position = recycler.getChildAdapterPosition(child)
val item = adapter.items.getOrNull(position) val item = adapter.items.getOrNull(position)
if (item is ReaderPage) { if (item is ReaderPage) {
activity.onPageLongTap(item) activity.onPageLongTap(item)
return@f true
} }
} }
false
}
frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT) frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
frame.addView(recycler) frame.addView(recycler)

View file

@ -108,6 +108,11 @@ class SettingsReaderController : SettingsController() {
titleRes = R.string.pref_read_with_tapping titleRes = R.string.pref_read_with_tapping
defaultValue = true defaultValue = true
} }
switchPreference {
key = Keys.readWithLongTap
titleRes = R.string.pref_read_with_long_tap
defaultValue = true
}
switchPreference { switchPreference {
key = Keys.readWithVolumeKeys key = Keys.readWithVolumeKeys
titleRes = R.string.pref_read_with_volume_keys titleRes = R.string.pref_read_with_volume_keys

View file

@ -123,11 +123,20 @@
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
app:layout_constraintTop_toBottomOf="@id/fullscreen" /> app:layout_constraintTop_toBottomOf="@id/fullscreen" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/long_tap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="@string/pref_read_with_long_tap"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintTop_toBottomOf="@id/keepscreen" />
<android.support.v4.widget.Space <android.support.v4.widget.Space
android:id="@+id/end_general_preferences" android:id="@+id/end_general_preferences"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/keepscreen" /> app:layout_constraintBottom_toBottomOf="@id/long_tap" />
<!-- Pager preferences --> <!-- Pager preferences -->

View file

@ -180,6 +180,7 @@
<string name="pref_read_with_volume_keys">Volume keys</string> <string name="pref_read_with_volume_keys">Volume keys</string>
<string name="pref_read_with_volume_keys_inverted">Invert volume keys</string> <string name="pref_read_with_volume_keys_inverted">Invert volume keys</string>
<string name="pref_read_with_tapping">Tapping</string> <string name="pref_read_with_tapping">Tapping</string>
<string name="pref_read_with_long_tap">Long tap dialog</string>
<string name="pref_reader_theme">Background color</string> <string name="pref_reader_theme">Background color</string>
<string name="white_background">White</string> <string name="white_background">White</string>
<string name="black_background">Black</string> <string name="black_background">Black</string>

View file

@ -19,9 +19,9 @@ buildscript {
allprojects { allprojects {
repositories { repositories {
google() google()
jcenter()
maven { url "https://jitpack.io" } maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
maven { url "https://dl.bintray.com/inorichi/maven" } maven { url "https://dl.bintray.com/inorichi/maven" }
} }
} }