Add License in LoadindDialog
[pub/Android/ownCloud.git] / src / com / owncloud / android / ui / dialog / LoadingDialog.java
1 /* ownCloud Android client application
2 * Copyright (C) 2012-2014 ownCloud Inc.
3 *
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.
7 *
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.
12 *
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/>.
15 *
16 */
17 package com.owncloud.android.ui.dialog;
18
19 import com.owncloud.android.R;
20
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;
29
30 public class LoadingDialog extends DialogFragment {
31
32 private String mMessage;
33
34 public LoadingDialog() {
35 super();
36 }
37
38 @Override
39 public void onCreate(Bundle savedInstanceState) {
40 super.onCreate(savedInstanceState);
41 setRetainInstance(true);
42 setCancelable(false);
43 }
44
45 public LoadingDialog(String message) {
46 this.mMessage = message;
47 }
48
49 @Override
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);
53
54 // set value
55 TextView tv = (TextView) v.findViewById(R.id.loadingText);
56 tv.setText(mMessage);
57
58 return v;
59 }
60
61 @Override
62 public Dialog onCreateDialog(Bundle savedInstanceState) {
63 Dialog dialog = super.onCreateDialog(savedInstanceState);
64 dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
65 return dialog;
66 }
67
68 @Override
69 public void onDestroyView() {
70 if (getDialog() != null && getRetainInstance())
71 getDialog().setDismissMessage(null);
72 super.onDestroyView();
73 }
74 }