fix #1266, allow disabling rotating with gestures

This commit is contained in:
tibbi 2019-02-14 22:17:18 +01:00
parent d72d8fd052
commit 9fabd88420
6 changed files with 42 additions and 1 deletions

View file

@ -75,7 +75,7 @@ dependencies {
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.caverock:androidsvg-aar:1.3'
implementation 'com.github.tibbi:gestureviews:bd0a8e67a1'
implementation 'com.github.tibbi:subsampling-scale-image-view:6c14987053'
implementation 'com.github.tibbi:subsampling-scale-image-view:fac1948e41'
kapt 'com.github.bumptech.glide:compiler:4.8.0' // keep it here too, not just in Commons, else loading SVGs wont work
kapt 'androidx.room:room-compiler:2.0.0'

View file

@ -61,6 +61,7 @@ class SettingsActivity : SimpleActivity() {
setupAllowPhotoGestures()
setupAllowVideoGestures()
setupAllowDownGesture()
setupAllowRotatingWithGestures()
setupShowNotch()
setupBottomActions()
setupThumbnailVideoDuration()
@ -349,6 +350,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupAllowRotatingWithGestures() {
settings_allow_rotating_with_gestures.isChecked = config.allowRotatingWithGestures
settings_allow_rotating_with_gestures_holder.setOnClickListener {
settings_allow_rotating_with_gestures.toggle()
config.allowRotatingWithGestures = settings_allow_rotating_with_gestures.isChecked
}
}
private fun setupShowNotch() {
settings_show_notch_holder.beVisibleIf(isPiePlus())
settings_show_notch.isChecked = config.showNotch
@ -600,6 +609,7 @@ class SettingsActivity : SimpleActivity() {
put(ALLOW_INSTANT_CHANGE, config.allowInstantChange)
put(ALLOW_PHOTO_GESTURES, config.allowPhotoGestures)
put(ALLOW_DOWN_GESTURE, config.allowDownGesture)
put(ALLOW_ROTATING_WITH_GESTURES, config.allowRotatingWithGestures)
put(SHOW_NOTCH, config.showNotch)
put(SCREEN_ROTATION, config.screenRotation)
put(ALLOW_ZOOMING_IMAGES, config.allowZoomingImages)
@ -720,6 +730,7 @@ class SettingsActivity : SimpleActivity() {
ALLOW_INSTANT_CHANGE -> config.allowInstantChange = value.toBoolean()
ALLOW_PHOTO_GESTURES -> config.allowPhotoGestures = value.toBoolean()
ALLOW_DOWN_GESTURE -> config.allowDownGesture = value.toBoolean()
ALLOW_ROTATING_WITH_GESTURES -> config.allowRotatingWithGestures = value.toBoolean()
SHOW_NOTCH -> config.showNotch = value.toBoolean()
SCREEN_ROTATION -> config.screenRotation = value.toInt()
ALLOW_ZOOMING_IMAGES -> config.allowZoomingImages = value.toBoolean()

View file

@ -459,6 +459,7 @@ class PhotoFragment : ViewPagerFragment() {
regionDecoderFactory = regionDecoder
maxScale = 10f
beVisible()
rotationEnabled = config.allowRotatingWithGestures
isOneToOneZoomEnabled = config.allowOneToOneZoom
orientation = newOrientation
setImage(path)

View file

@ -456,6 +456,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(ALLOW_ONE_TO_ONE_ZOOM, false)
set(allowOneToOneZoom) = prefs.edit().putBoolean(ALLOW_ONE_TO_ONE_ZOOM, allowOneToOneZoom).apply()
var allowRotatingWithGestures: Boolean
get() = prefs.getBoolean(ALLOW_ROTATING_WITH_GESTURES, true)
set(allowRotatingWithGestures) = prefs.edit().putBoolean(ALLOW_ROTATING_WITH_GESTURES, allowRotatingWithGestures).apply()
var lastEditorDrawColor: Int
get() = prefs.getInt(LAST_EDITOR_DRAW_COLOR, primaryColor)
set(lastEditorDrawColor) = prefs.edit().putInt(LAST_EDITOR_DRAW_COLOR, lastEditorDrawColor).apply()

View file

@ -75,6 +75,7 @@ const val LAST_EDITOR_CROP_OTHER_ASPECT_RATIO_Y = "last_editor_crop_other_aspect
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"
const val ALLOW_ROTATING_WITH_GESTURES = "allow_rotating_with_gestures"
const val LAST_EDITOR_DRAW_COLOR = "last_editor_draw_color"
const val LAST_EDITOR_BRUSH_SIZE = "last_editor_brush_size"
const val SHOW_NOTCH = "show_notch"

View file

@ -694,6 +694,30 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_allow_rotating_with_gestures_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_rotating_with_gestures"
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_rotating_gestures"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_notch_holder"
android:layout_width="match_parent"