2 * ownCloud Android client application
4 * Copyright (C) 2015 ownCloud Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 package com
.owncloud
.android
.ui
.dialog
;
21 import com
.owncloud
.android
.R
;
23 import android
.app
.Dialog
;
24 import android
.os
.Bundle
;
25 import android
.support
.v4
.app
.DialogFragment
;
26 import android
.view
.LayoutInflater
;
27 import android
.view
.View
;
28 import android
.view
.ViewGroup
;
29 import android
.view
.Window
;
30 import android
.widget
.TextView
;
32 public class LoadingDialog
extends DialogFragment
{
34 private String mMessage
;
36 public LoadingDialog() {
41 public void onCreate(Bundle savedInstanceState
) {
42 super.onCreate(savedInstanceState
);
43 setRetainInstance(true
);
47 public LoadingDialog(String message
) {
48 this.mMessage
= message
;
52 public View
onCreateView(LayoutInflater inflater
, ViewGroup container
, Bundle savedInstanceState
) {
53 // Create a view by inflating desired layout
54 View v
= inflater
.inflate(R
.layout
.loading_dialog
, container
, false
);
57 TextView tv
= (TextView
) v
.findViewById(R
.id
.loadingText
);
64 public Dialog
onCreateDialog(Bundle savedInstanceState
) {
65 Dialog dialog
= super.onCreateDialog(savedInstanceState
);
66 dialog
.requestWindowFeature(Window
.FEATURE_NO_TITLE
);
71 public void onDestroyView() {
72 if (getDialog() != null
&& getRetainInstance())
73 getDialog().setDismissMessage(null
);
74 super.onDestroyView();