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