From: tobiasKaminsky Date: Thu, 13 Aug 2015 18:11:58 +0000 (+0200) Subject: fixed bug caused by rotating the device X-Git-Tag: oc-android-1.8~17^2~4^2~1 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/be5dbcbb2e5afef17d47b4cbbf9e0eb08de69da4?ds=sidebyside fixed bug caused by rotating the device --- diff --git a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java index e9479a35..c1511aae 100644 --- a/src/com/owncloud/android/ui/preview/PreviewTextFragment.java +++ b/src/com/owncloud/android/ui/preview/PreviewTextFragment.java @@ -202,11 +202,20 @@ public class PreviewTextFragment extends FileFragment { * Show loading dialog */ public void showLoadingDialog() { - // Construct dialog - LoadingDialog loading = new LoadingDialog(getResources().getString(R.string.wait_a_moment)); - FragmentManager fm = getActivity().getSupportFragmentManager(); - FragmentTransaction ft = fm.beginTransaction(); - loading.show(ft, DIALOG_WAIT_TAG); + // only once + Fragment frag = getActivity().getSupportFragmentManager().findFragmentByTag(DIALOG_WAIT_TAG); + LoadingDialog loading = null; + if (frag == null) { + // Construct dialog + loading = new LoadingDialog(getResources().getString(R.string.wait_a_moment)); + FragmentManager fm = getActivity().getSupportFragmentManager(); + FragmentTransaction ft = fm.beginTransaction(); + loading.show(ft, DIALOG_WAIT_TAG); + } else { + loading = (LoadingDialog) frag; + loading.setShowsDialog(true); + } + } /**