mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Reduce priority of jcenter repository
This commit is contained in:
parent
f8e121ee06
commit
3f2d375a53
13 changed files with 57 additions and 19 deletions
|
@ -41,6 +41,8 @@ object PreferenceKeys {
|
|||
|
||||
const val readWithTapping = "reader_tap"
|
||||
|
||||
const val readWithLongTap = "reader_long_tap"
|
||||
|
||||
const val readWithVolumeKeys = "reader_volume_keys"
|
||||
|
||||
const val readWithVolumeKeysInverted = "reader_volume_keys_inverted"
|
||||
|
|
|
@ -69,6 +69,8 @@ class PreferencesHelper(val context: Context) {
|
|||
|
||||
fun readWithTapping() = rxPrefs.getBoolean(Keys.readWithTapping, true)
|
||||
|
||||
fun readWithLongTap() = rxPrefs.getBoolean(Keys.readWithLongTap, true)
|
||||
|
||||
fun readWithVolumeKeys() = rxPrefs.getBoolean(Keys.readWithVolumeKeys, false)
|
||||
|
||||
fun readWithVolumeKeysInverted() = rxPrefs.getBoolean(Keys.readWithVolumeKeysInverted, false)
|
||||
|
|
|
@ -62,6 +62,7 @@ class ReaderSettingsSheet(private val activity: ReaderActivity) : BottomSheetDia
|
|||
show_page_number.bindToPreference(preferences.showPageNumber())
|
||||
fullscreen.bindToPreference(preferences.fullscreen())
|
||||
keepscreen.bindToPreference(preferences.keepScreenOn())
|
||||
long_tap.bindToPreference(preferences.readWithLongTap())
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -25,7 +25,7 @@ open class Pager(
|
|||
/**
|
||||
* 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.
|
||||
|
@ -38,8 +38,7 @@ open class Pager(
|
|||
|
||||
override fun onLongTapConfirmed(ev: MotionEvent) {
|
||||
val listener = longTapListener
|
||||
if (listener != null) {
|
||||
listener.invoke(ev)
|
||||
if (listener != null && listener.invoke(ev)) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
|||
var tappingEnabled = true
|
||||
private set
|
||||
|
||||
var longTapEnabled = true
|
||||
private set
|
||||
|
||||
var volumeKeysEnabled = false
|
||||
private set
|
||||
|
||||
|
@ -44,6 +47,9 @@ class PagerConfig(private val viewer: PagerViewer, preferences: PreferencesHelpe
|
|||
preferences.readWithTapping()
|
||||
.register({ tappingEnabled = it })
|
||||
|
||||
preferences.readWithLongTap()
|
||||
.register({ longTapEnabled = it })
|
||||
|
||||
preferences.pageTransitions()
|
||||
.register({ usePageTransitions = it })
|
||||
|
||||
|
|
|
@ -92,12 +92,16 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
|||
else -> activity.toggleMenu()
|
||||
}
|
||||
}
|
||||
pager.longTapListener = {
|
||||
pager.longTapListener = f@ {
|
||||
if (activity.menuVisible || config.longTapEnabled) {
|
||||
val item = adapter.items.getOrNull(pager.currentItem)
|
||||
if (item is ReaderPage) {
|
||||
activity.onPageLongTap(item)
|
||||
return@f true
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
config.imagePropertyChangedListener = {
|
||||
refreshAdapter()
|
||||
|
|
|
@ -19,6 +19,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
|
|||
var tappingEnabled = true
|
||||
private set
|
||||
|
||||
var longTapEnabled = true
|
||||
private set
|
||||
|
||||
var volumeKeysEnabled = false
|
||||
private set
|
||||
|
||||
|
@ -35,6 +38,9 @@ class WebtoonConfig(preferences: PreferencesHelper = Injekt.get()) {
|
|||
preferences.readWithTapping()
|
||||
.register({ tappingEnabled = it })
|
||||
|
||||
preferences.readWithLongTap()
|
||||
.register({ longTapEnabled = it })
|
||||
|
||||
preferences.cropBordersWebtoon()
|
||||
.register({ imageCropBorders = it }, { imagePropertyChangedListener?.invoke() })
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
|
|||
private val detector = Detector()
|
||||
|
||||
var tapListener: ((MotionEvent) -> Unit)? = null
|
||||
var longTapListener: ((MotionEvent) -> Unit)? = null
|
||||
var longTapListener: ((MotionEvent) -> Boolean)? = null
|
||||
|
||||
override fun onMeasure(widthSpec: Int, heightSpec: Int) {
|
||||
halfWidth = MeasureSpec.getSize(widthSpec) / 2
|
||||
|
@ -220,8 +220,7 @@ open class WebtoonRecyclerView @JvmOverloads constructor(
|
|||
|
||||
override fun onLongTapConfirmed(ev: MotionEvent) {
|
||||
val listener = longTapListener
|
||||
if (listener != null) {
|
||||
listener.invoke(ev)
|
||||
if (listener != null && listener.invoke(ev)) {
|
||||
performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,14 +95,18 @@ class WebtoonViewer(val activity: ReaderActivity) : BaseViewer {
|
|||
else -> activity.toggleMenu()
|
||||
}
|
||||
}
|
||||
recycler.longTapListener = { event ->
|
||||
recycler.longTapListener = f@ { event ->
|
||||
if (activity.menuVisible || config.longTapEnabled) {
|
||||
val child = recycler.findChildViewUnder(event.x, event.y)
|
||||
val position = recycler.getChildAdapterPosition(child)
|
||||
val item = adapter.items.getOrNull(position)
|
||||
if (item is ReaderPage) {
|
||||
activity.onPageLongTap(item)
|
||||
return@f true
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
frame.layoutParams = ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)
|
||||
frame.addView(recycler)
|
||||
|
|
|
@ -108,6 +108,11 @@ class SettingsReaderController : SettingsController() {
|
|||
titleRes = R.string.pref_read_with_tapping
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.readWithLongTap
|
||||
titleRes = R.string.pref_read_with_long_tap
|
||||
defaultValue = true
|
||||
}
|
||||
switchPreference {
|
||||
key = Keys.readWithVolumeKeys
|
||||
titleRes = R.string.pref_read_with_volume_keys
|
||||
|
|
|
@ -123,11 +123,20 @@
|
|||
android:textColor="?android:attr/textColorSecondary"
|
||||
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:id="@+id/end_general_preferences"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/keepscreen" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/long_tap" />
|
||||
|
||||
<!-- Pager preferences -->
|
||||
|
||||
|
|
|
@ -180,6 +180,7 @@
|
|||
<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_tapping">Tapping</string>
|
||||
<string name="pref_read_with_long_tap">Long tap dialog</string>
|
||||
<string name="pref_reader_theme">Background color</string>
|
||||
<string name="white_background">White</string>
|
||||
<string name="black_background">Black</string>
|
||||
|
|
|
@ -19,9 +19,9 @@ buildscript {
|
|||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
jcenter()
|
||||
maven { url "https://dl.bintray.com/inorichi/maven" }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue