| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /*
- * $URL$
- * $Revision$
- * $LastChangedBy$
- * $LastChangedDate$
- *
- * Copyright (c) 2005 syseca AG, Switzerland
- * All rights reserved.
- *
- * This software is the confidential and proprietary information
- * of syseca AG. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only
- * in accordance with the terms of the license agreement you
- * entered into with syseca AG.
- */
- package ch.spherIC.recurvebowsight;
-
- import android.app.Activity;
- import android.app.Dialog;
-
- import android.content.pm.PackageManager;
- import android.content.pm.PackageManager.NameNotFoundException;
-
- import android.view.View;
-
- import android.view.View.OnClickListener;
-
- import android.widget.Button;
- import android.widget.ImageView;
- import android.widget.TextView;
-
- import ch.spherIC.recurvebowsight.dialog.ChooseArcherySetupDlg;
-
-
- /**
- * Dialog factory class.
- */
- public final class DialogFactory {
-
-
- /**
- * Static main method to initialize classes
- *
- * @param dlgCode Code of dialog to instantiate. See {@link EasyBracketMain}
- * @param parent Parent {@link Activity}
- *
- * @return Instantiated dialog.
- */
- public static Dialog createDialog(final int dlgCode, final Activity parent) {
-
- Dialog dlg;
-
- switch (dlgCode) {
-
- case RBSMainActivity.DLG_CHOOSE_ARCHERYSETUP:
- dlg = createChooseArcherySetupDialog(parent);
- break;
-
- case RBSMainActivity.DLG_ABOUT:
- dlg = createAboutDialog(parent);
- break;
-
- case RBSMainActivity.DLG_USERGUIDE_PARAMS_SIGHT:
- dlg = createUserguideParamsDialog(parent);
- break;
-
- default:
- dlg = null;
- break;
- }
-
- return dlg;
- }
-
- /**
- * @param parent
- *
- * @return
- */
- private static Dialog createUserguideParamsDialog(final Activity parent) {
- final Dialog dialog = new Dialog(parent);
-
- dialog.setContentView(R.layout.rbs_userguide_dialog);
- dialog.setTitle(parent.getResources().getText(R.string.menuUserGuide).toString());
-
- ImageView image = (ImageView) dialog.findViewById(R.id.ug_image);
- image.setImageResource(R.drawable.userguide_params);
-
- TextView text = (TextView) dialog.findViewById(R.id.ug_txt_HowTo);
- text.setText(parent.getResources().getString(R.string.caption_UserguideParams, parent.getResources().getString(R.string.arrowNockHeightLbl),
- parent.getResources().getString(R.string.targetCenterHeightLbl),
- parent.getResources().getString(R.string.shootingDistanzLbl),
- parent.getResources().getString(R.string.ashNA),
- parent.getResources().getString(R.string.bowPulloutLbl),
- parent.getResources().getString(R.string.asNockRaising),
- parent.getResources().getString(R.string.asBraceHeight)));
-
- ((Button) dialog.findViewById(R.id.btn_ugClose)).setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(final View v) {
- dialog.dismiss();
- }
- });
-
- return dialog;
- }
-
- private static Dialog createChooseArcherySetupDialog(final Activity parent) {
- final ChooseArcherySetupDlg dialog = new ChooseArcherySetupDlg(parent);
- return dialog;
- }
-
- /**
- * Creates the About Dialog
- */
- private static Dialog createAboutDialog(final Activity parent) {
-
- String versionName = "";
- final Dialog dialog = new Dialog(parent);
-
- dialog.setContentView(R.layout.rbs_about_dialog);
- dialog.setTitle(parent.getResources().getText(R.string.menuAbout).toString());
-
- try {
- versionName = parent.getPackageManager().getPackageInfo("ch.spherIC", PackageManager.GET_CONFIGURATIONS).versionName;
- } catch (NameNotFoundException e) {
- versionName = "-";
- }
-
- ImageView image = (ImageView) dialog.findViewById(R.id.about_imageAppIcon);
- image.setImageResource(R.drawable.ic_launcher);
-
- TextView text = (TextView) dialog.findViewById(R.id.about_TextDescription);
- text.setText(parent.getResources().getText(R.string.about_Description));
-
- text = (TextView) dialog.findViewById(R.id.about_TextVersion);
- text.setText(parent.getResources().getText(R.string.AppVersionLabel).toString() + " " + versionName);
-
- text = (TextView) dialog.findViewById(R.id.about_TextAutor);
- text.setText(parent.getResources().getText(R.string.about_DevelopedBy).toString());
-
- ((Button) dialog.findViewById(R.id.btn_AboutClose)).setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(final View v) {
- dialog.dismiss();
- }
- });
-
- return dialog;
- }
-
- }
|