|
@@ -22,11 +22,13 @@
|
|
|
package com.owncloud.android.ui.fragment
|
|
|
|
|
|
import android.content.Context
|
|
|
+import android.content.res.Configuration
|
|
|
import android.os.Bundle
|
|
|
import android.text.TextUtils
|
|
|
import android.view.LayoutInflater
|
|
|
import android.view.View
|
|
|
import android.view.ViewGroup
|
|
|
+import androidx.fragment.app.DialogFragment
|
|
|
import androidx.fragment.app.Fragment
|
|
|
import com.owncloud.android.R
|
|
|
import com.owncloud.android.databinding.FileDetailsSharingProcessFragmentBinding
|
|
@@ -116,6 +118,8 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
|
|
|
private var isReshareShown: Boolean = true // show or hide reshare option
|
|
|
private var isExpDateShown: Boolean = true // show or hide expiry date option
|
|
|
|
|
|
+ private var datePickerFragment: DialogFragment? = null
|
|
|
+
|
|
|
override fun onAttach(context: Context) {
|
|
|
super.onAttach(context)
|
|
|
try {
|
|
@@ -160,6 +164,18 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
|
|
|
implementClickEvents()
|
|
|
}
|
|
|
|
|
|
+ override fun onConfigurationChanged(newConfig: Configuration) {
|
|
|
+ super.onConfigurationChanged(newConfig)
|
|
|
+ // Force recreation of dialog fragment when screen rotates
|
|
|
+ // This is needed because the calendar layout should be different in portrait and landscape,
|
|
|
+ // but as FDA persists through config changes, the dialog is not recreated automatically
|
|
|
+ val datePicker = datePickerFragment
|
|
|
+ if (datePicker?.dialog?.isShowing == true) {
|
|
|
+ datePicker.dismiss()
|
|
|
+ showExpirationDateDialog()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private fun showShareProcessFirst() {
|
|
|
binding.shareProcessGroupOne.visibility = View.VISIBLE
|
|
|
binding.shareProcessEditShareLink.visibility = View.VISIBLE
|
|
@@ -350,9 +366,10 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
|
|
|
private fun showExpirationDateDialog() {
|
|
|
val dialog = ExpirationDatePickerDialogFragment.newInstance(chosenExpDateInMills)
|
|
|
dialog.setOnExpiryDateListener(this)
|
|
|
- fileActivity?.let { it1 ->
|
|
|
+ datePickerFragment = dialog
|
|
|
+ fileActivity?.let {
|
|
|
dialog.show(
|
|
|
- it1.supportFragmentManager,
|
|
|
+ it.supportFragmentManager,
|
|
|
ExpirationDatePickerDialogFragment.DATE_PICKER_DIALOG
|
|
|
)
|
|
|
}
|