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
.graphics
.PorterDuff
;
25 import android
.os
.Bundle
;
26 import android
.support
.v4
.app
.DialogFragment
;
27 import android
.view
.LayoutInflater
;
28 import android
.view
.View
;
29 import android
.view
.ViewGroup
;
30 import android
.view
.Window
;
31 import android
.widget
.ProgressBar
;
32 import android
.widget
.TextView
;
34 public class LoadingDialog
extends DialogFragment
{
36 private String mMessage
;
38 public LoadingDialog() {
43 public void onCreate(Bundle savedInstanceState
) {
44 super.onCreate(savedInstanceState
);
45 setRetainInstance(true
);
49 public LoadingDialog(String message
) {
50 this.mMessage
= message
;
54 public View
onCreateView(LayoutInflater inflater
, ViewGroup container
, Bundle savedInstanceState
) {
55 // Create a view by inflating desired layout
56 View v
= inflater
.inflate(R
.layout
.loading_dialog
, container
, false
);
59 TextView tv
= (TextView
) v
.findViewById(R
.id
.loadingText
);
62 // set progress wheel color
63 ProgressBar progressBar
= (ProgressBar
) v
.findViewById(R
.id
.loadingBar
);
64 progressBar
.getIndeterminateDrawable().setColorFilter(
65 getResources().getColor(R
.color
.color_accent
), PorterDuff
.Mode
.SRC_IN
);
71 public Dialog
onCreateDialog(Bundle savedInstanceState
) {
72 Dialog dialog
= super.onCreateDialog(savedInstanceState
);
73 dialog
.requestWindowFeature(Window
.FEATURE_NO_TITLE
);
78 public void onDestroyView() {
79 if (getDialog() != null
&& getRetainInstance())
80 getDialog().setDismissMessage(null
);
81 super.onDestroyView();