b5294954f73846e7741ad6ba53943038f6460ebf
[pub/Android/ownCloud.git] / src / de / mobilcom / debitel / cloud / android / extensions / ExtensionsAvailableDialog.java
1 /* ownCloud Android client application
2 * Copyright (C) 2012 Bartek Przybylski
3 * Copyright (C) 2012-2013 ownCloud Inc.
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2,
7 * as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19 package de.mobilcom.debitel.cloud.android.extensions;
20
21 import de.mobilcom.debitel.cloud.android.Log_OC;
22 import de.mobilcom.debitel.cloud.android.R;
23 import android.content.Intent;
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.View.OnClickListener;
30 import android.widget.Button;
31
32 public class ExtensionsAvailableDialog extends DialogFragment implements
33 OnClickListener {
34
35 public ExtensionsAvailableDialog() {
36 }
37
38 @Override
39 public View onCreateView(LayoutInflater inflater, ViewGroup container,
40 Bundle savedInstanceState) {
41 View view = inflater.inflate(R.layout.extensions_available_dialog,
42 container);
43 Button btnYes = (Button) view.findViewById(R.id.buttonYes);
44 Button btnNo = (Button) view.findViewById(R.id.buttonNo);
45
46 // Set background of buttons
47 boolean customButtons = getResources().getBoolean(R.bool.custom_buttons);
48 if (customButtons) {
49 btnYes.setBackgroundResource(R.drawable.btn_default);
50 btnNo.setBackgroundResource(R.drawable.btn_default);
51 }
52
53 btnYes.setOnClickListener(this);
54 btnNo.setOnClickListener(this);
55 getDialog().setTitle(R.string.extensions_avail_title);
56 return view;
57 }
58
59 @Override
60 public void onClick(View v) {
61 switch (v.getId()) {
62 case R.id.buttonYes: {
63 Intent i = new Intent(getActivity(), ExtensionsListActivity.class);
64 startActivity(i);
65 getActivity().finish();
66 }
67 break;
68 case R.id.buttonNo:
69 getActivity().finish();
70 break;
71 default:
72 Log_OC.e("EAD", "Button with unknown id clicked " + v.getId());
73 }
74 }
75
76 }