Version für alte Androidversionen der Visiereinstellung für Recurvebogen.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DialogFactory.java 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * $URL$
  3. * $Revision$
  4. * $LastChangedBy$
  5. * $LastChangedDate$
  6. *
  7. * Copyright (c) 2005 syseca AG, Switzerland
  8. * All rights reserved.
  9. *
  10. * This software is the confidential and proprietary information
  11. * of syseca AG. ("Confidential Information"). You shall not
  12. * disclose such Confidential Information and shall use it only
  13. * in accordance with the terms of the license agreement you
  14. * entered into with syseca AG.
  15. */
  16. package ch.spherIC.recurvebowsight;
  17. import android.app.Activity;
  18. import android.app.Dialog;
  19. import android.content.pm.PackageManager;
  20. import android.content.pm.PackageManager.NameNotFoundException;
  21. import android.view.View;
  22. import android.view.View.OnClickListener;
  23. import android.widget.Button;
  24. import android.widget.ImageView;
  25. import android.widget.TextView;
  26. import ch.spherIC.recurvebowsight.dialog.ChooseArcherySetupDlg;
  27. /**
  28. * Dialog factory class.
  29. */
  30. public final class DialogFactory {
  31. /**
  32. * Static main method to initialize classes
  33. *
  34. * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain}
  35. * @param parent Parent {@link Activity}
  36. *
  37. * @return Instantiated dialog.
  38. */
  39. public static Dialog createDialog(final int dlgCode, final Activity parent) {
  40. Dialog dlg;
  41. switch (dlgCode) {
  42. case RBSMainActivity.DLG_CHOOSE_ARCHERYSETUP:
  43. dlg = createChooseArcherySetupDialog(parent);
  44. break;
  45. case RBSMainActivity.DLG_ABOUT:
  46. dlg = createAboutDialog(parent);
  47. break;
  48. case RBSMainActivity.DLG_USERGUIDE_PARAMS_SIGHT:
  49. dlg = createUserguideParamsDialog(parent);
  50. break;
  51. default:
  52. dlg = null;
  53. break;
  54. }
  55. return dlg;
  56. }
  57. /**
  58. * @param parent
  59. *
  60. * @return
  61. */
  62. private static Dialog createUserguideParamsDialog(final Activity parent) {
  63. final Dialog dialog = new Dialog(parent);
  64. dialog.setContentView(R.layout.rbs_userguide_dialog);
  65. dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide).toString());
  66. ImageView image = (ImageView) dialog.findViewById(R.id.ug_image);
  67. image.setImageResource(R.drawable.userguide_params);
  68. TextView text = (TextView) dialog.findViewById(R.id.ug_txt_HowTo);
  69. text.setText(parent.getResources().getString(R.string.caption_UserguideParams, parent.getResources().getString(R.string.arrowNockHeightLbl),
  70. parent.getResources().getString(R.string.targetCenterHeightLbl),
  71. parent.getResources().getString(R.string.shootingDistanzLbl),
  72. parent.getResources().getString(R.string.ashNA),
  73. parent.getResources().getString(R.string.bowPulloutLbl),
  74. parent.getResources().getString(R.string.asNockRaising),
  75. parent.getResources().getString(R.string.asBraceHeight)));
  76. ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() {
  77. @Override
  78. public void onClick(final View v) {
  79. dialog.dismiss();
  80. }
  81. });
  82. return dialog;
  83. }
  84. private static Dialog createChooseArcherySetupDialog(final Activity parent) {
  85. final ChooseArcherySetupDlg dialog = new ChooseArcherySetupDlg(parent);
  86. return dialog;
  87. }
  88. /**
  89. * Creates the About Dialog
  90. */
  91. private static Dialog createAboutDialog(final Activity parent) {
  92. String versionName = "";
  93. final Dialog dialog = new Dialog(parent);
  94. dialog.setContentView(R.layout.rbs_about_dialog);
  95. dialog.setTitle(parent.getResources().getText(R.string.menuAbout).toString());
  96. try {
  97. versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS).versionName;
  98. } catch (NameNotFoundException e) {
  99. versionName = "-";
  100. }
  101. ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon);
  102. image.setImageResource(R.drawable.ic_launcher);
  103. TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription);
  104. text.setText(parent.getResources().getText(R.string.about_Description));
  105. text = (TextView) dialog.findViewById(R.id.about_TextVersion);
  106. text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() + " " + versionName);
  107. text = (TextView) dialog.findViewById(R.id.about_TextAutor);
  108. text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString());
  109. ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() {
  110. @Override
  111. public void onClick(final View v) {
  112. dialog.dismiss();
  113. }
  114. });
  115. return dialog;
  116. }
  117. }