mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 08:18:00 +01:00
fix #297, allow one to one pixel ratio zooming with two double taps
This commit is contained in:
parent
61e51058da
commit
4be9c0b431
6 changed files with 46 additions and 5 deletions
|
@ -78,7 +78,7 @@ dependencies {
|
|||
|
||||
//implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
|
||||
//implementation 'com.github.tibbi:subsampling-scale-image-view:v3.10.1-fork'
|
||||
implementation 'com.github.tibbi:subsampling-scale-image-view:4.0.2'
|
||||
implementation 'com.github.tibbi:subsampling-scale-image-view:7a000e651e'
|
||||
|
||||
// implementation 'com.github.chrisbanes:PhotoView:2.3.0'
|
||||
implementation 'com.github.tibbi:PhotoView:2.3.0-fork'
|
||||
|
|
|
@ -65,6 +65,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
setupAllowZoomingImages()
|
||||
setupShowHighestQuality()
|
||||
setupOneFingerZoom()
|
||||
setupAllowOneToOneZoom()
|
||||
setupAllowInstantChange()
|
||||
setupShowExtendedDetails()
|
||||
setupHideExtendedDetails()
|
||||
|
@ -377,6 +378,7 @@ class SettingsActivity : SimpleActivity() {
|
|||
private fun updateDeepZoomToggleButtons() {
|
||||
settings_one_finger_zoom_holder.beVisibleIf(config.allowZoomingImages)
|
||||
settings_show_highest_quality_holder.beVisibleIf(config.allowZoomingImages)
|
||||
settings_allow_one_to_one_zoom_holder.beVisibleIf(config.allowZoomingImages)
|
||||
}
|
||||
|
||||
private fun setupShowHighestQuality() {
|
||||
|
@ -395,6 +397,14 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupAllowOneToOneZoom() {
|
||||
settings_allow_one_to_one_zoom.isChecked = config.allowOneToOneZoom
|
||||
settings_allow_one_to_one_zoom_holder.setOnClickListener {
|
||||
settings_allow_one_to_one_zoom.toggle()
|
||||
config.allowOneToOneZoom = settings_allow_one_to_one_zoom.isChecked
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAllowInstantChange() {
|
||||
settings_allow_instant_change.isChecked = config.allowInstantChange
|
||||
settings_allow_instant_change_holder.setOnClickListener {
|
||||
|
|
|
@ -393,15 +393,17 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
override fun make() = PicassoRegionDecoder()
|
||||
}
|
||||
|
||||
val config = context!!.config
|
||||
view.subsampling_view.apply {
|
||||
setMaxTileSize(if (context!!.config.showHighestQuality) Integer.MAX_VALUE else 4096)
|
||||
setMinimumTileDpi(if (context!!.config.showHighestQuality) -1 else getMinTileDpi())
|
||||
setMaxTileSize(if (config.showHighestQuality) Integer.MAX_VALUE else 4096)
|
||||
setMinimumTileDpi(if (config.showHighestQuality) -1 else getMinTileDpi())
|
||||
background = ColorDrawable(Color.TRANSPARENT)
|
||||
setBitmapDecoderFactory(bitmapDecoder)
|
||||
setRegionDecoderFactory(regionDecoder)
|
||||
maxScale = 10f
|
||||
beVisible()
|
||||
isQuickScaleEnabled = context.config.oneFingerZoom
|
||||
isQuickScaleEnabled = config.oneFingerZoom
|
||||
isOneToOneZoomEnabled = config.allowOneToOneZoom
|
||||
setResetScaleOnSizeChange(false)
|
||||
setImage(ImageSource.uri(path))
|
||||
setOrientation(rotation)
|
||||
|
@ -411,7 +413,7 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
}
|
||||
|
||||
override fun onReady() {
|
||||
background = ColorDrawable(if (context.config.blackBackground) Color.BLACK else context.config.backgroundColor)
|
||||
background = ColorDrawable(if (config.blackBackground) Color.BLACK else config.backgroundColor)
|
||||
val useWidth = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sHeight else sWidth
|
||||
val useHeight = if (imageOrientation == ORIENTATION_ROTATE_90 || imageOrientation == ORIENTATION_ROTATE_270) sWidth else sHeight
|
||||
setDoubleTapZoomScale(getDoubleTapZoomScale(useWidth, useHeight))
|
||||
|
|
|
@ -441,4 +441,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var showWidgetFolderName: Boolean
|
||||
get() = prefs.getBoolean(SHOW_WIDGET_FOLDER_NAME, true)
|
||||
set(showWidgetFolderName) = prefs.edit().putBoolean(SHOW_WIDGET_FOLDER_NAME, showWidgetFolderName).apply()
|
||||
|
||||
var allowOneToOneZoom: Boolean
|
||||
get() = prefs.getBoolean(ALLOW_ONE_TO_ONE_ZOOM, false)
|
||||
set(allowOneToOneZoom) = prefs.edit().putBoolean(ALLOW_ONE_TO_ONE_ZOOM, allowOneToOneZoom).apply()
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@ const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_X = "last_editor_crop_other_aspect
|
|||
const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y = "last_editor_crop_other_aspect_ratio_y"
|
||||
const val GROUP_DIRECT_SUBFOLDERS = "group_direct_subfolders"
|
||||
const val SHOW_WIDGET_FOLDER_NAME = "show_widget_folder_name"
|
||||
const val ALLOW_ONE_TO_ONE_ZOOM = "allow_one_to_one_zoom"
|
||||
|
||||
// slideshow
|
||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
|
|
@ -795,6 +795,30 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/settings_allow_one_to_one_zoom_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/medium_margin"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:paddingLeft="@dimen/normal_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/normal_margin"
|
||||
android:paddingBottom="@dimen/activity_margin">
|
||||
|
||||
<com.simplemobiletools.commons.views.MySwitchCompat
|
||||
android:id="@+id/settings_allow_one_to_one_zoom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:text="@string/allow_one_to_one_zoom"
|
||||
app:switchPadding="@dimen/medium_margin"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/extended_details_divider"
|
||||
android:layout_width="match_parent"
|
||||
|
|
Loading…
Reference in a new issue