ExtensionsAvailableDialog.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 as published by
  7. * the Free Software Foundation, either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  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.
  14. *
  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/>.
  17. *
  18. */
  19. package com.owncloud.android.extensions;
  20. import com.owncloud.android.R;
  21. import android.content.Intent;
  22. import android.os.Bundle;
  23. import android.support.v4.app.DialogFragment;
  24. import android.util.Log;
  25. import android.view.LayoutInflater;
  26. import android.view.View;
  27. import android.view.ViewGroup;
  28. import android.view.View.OnClickListener;
  29. import android.widget.Button;
  30. public class ExtensionsAvailableDialog extends DialogFragment implements
  31. OnClickListener {
  32. public ExtensionsAvailableDialog() {
  33. }
  34. @Override
  35. public View onCreateView(LayoutInflater inflater, ViewGroup container,
  36. Bundle savedInstanceState) {
  37. View view = inflater.inflate(R.layout.extensions_available_dialog,
  38. container);
  39. Button btnYes = (Button) view.findViewById(R.id.buttonYes);
  40. Button btnNo = (Button) view.findViewById(R.id.buttonNo);
  41. btnYes.setOnClickListener(this);
  42. btnNo.setOnClickListener(this);
  43. getDialog().setTitle(R.string.extensions_avail_title);
  44. return view;
  45. }
  46. @Override
  47. public void onClick(View v) {
  48. switch (v.getId()) {
  49. case R.id.buttonYes: {
  50. Intent i = new Intent(getActivity(), ExtensionsListActivity.class);
  51. startActivity(i);
  52. getActivity().finish();
  53. }
  54. break;
  55. case R.id.buttonNo:
  56. getActivity().finish();
  57. break;
  58. default:
  59. Log.e("EAD", "Button with unknown id clicked " + v.getId());
  60. }
  61. }
  62. }