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/>.
18 package com
.owncloud
.android
.ui
.dialog
;
20 import android
.app
.AlertDialog
;
21 import android
.app
.Dialog
;
22 import android
.content
.DialogInterface
;
23 import android
.os
.Bundle
;
25 import com
.actionbarsherlock
.app
.SherlockDialogFragment
;
26 import com
.owncloud
.android
.R
;
28 public class AlertMessageDialog
extends SherlockDialogFragment
{
30 private static final String ARG_TITLE_ID
= AlertMessageDialog
.class.getCanonicalName() + ".ARG_TITLE_ID";
31 private static final String ARG_MESSAGE_ID
= AlertMessageDialog
.class.getCanonicalName() + ".ARG_MESSAGE_ID";
34 public static AlertMessageDialog
newInstance(int title
, int message
) {
35 AlertMessageDialog frag
= new AlertMessageDialog();
36 Bundle args
= new Bundle();
37 args
.putInt(ARG_TITLE_ID
, title
);
38 args
.putInt(ARG_MESSAGE_ID
, message
);
39 frag
.setArguments(args
);
44 public Dialog
onCreateDialog(Bundle savedInstanceState
) {
45 AlertDialog
.Builder dialogBuilder
= new AlertDialog
.Builder(getSherlockActivity());
47 int title
= getArguments().getInt(ARG_TITLE_ID
);
48 int message
= getArguments().getInt(ARG_MESSAGE_ID
);
50 dialogBuilder
.setIcon(R
.drawable
.common_error
)
54 .setPositiveButton(R
.string
.common_ok
,
55 new DialogInterface
.OnClickListener() {
56 public void onClick(DialogInterface dialog
, int whichButton
) {
60 return dialogBuilder
.create();