Пример #1
0
 // 显示“视频下载安装”对话框
 protected void showApprovaDialog() {
   LayoutInflater inflater = LayoutInflater.from(activity);
   View layout = inflater.inflate(R.layout.approva_dialog, null);
   approvaDialog = new AlertDialog.Builder(activity).create();
   approvaDialog.setCancelable(false);
   approvaDialog.show();
   approvaDialog.getWindow().setContentView(layout);
   approvaDialog.setCancelable(true);
   TextView edit_approva = (TextView) layout.findViewById(R.id.edit_approva);
   ImageView close_btn = (ImageView) layout.findViewById(R.id.close_btn);
   // Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel);
   edit_approva.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View arg0) {
           approvaDialog.dismiss();
         }
       });
   close_btn.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           approvaDialog.dismiss();
         }
       });
 }
  /** Presenta dialogo inicial */
  private void createInitDialog() {
    dialogInit = new Dialog(this, R.style.FullHeightDialog);
    dialogInit.setContentView(R.layout.yesno);
    dialogInit.setCancelable(false);

    // to set the message
    TextView message = (TextView) dialogInit.findViewById(R.id.yesnotext);
    message.setText(getString(R.string.verify_mh));

    // add some action to the buttons

    Button yes = (Button) dialogInit.findViewById(R.id.yesnoYes);
    yes.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            dialogInit.dismiss();
            addSintomas();
          }
        });

    Button no = (Button) dialogInit.findViewById(R.id.yesnoNo);
    no.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            // Cierra
            dialogInit.dismiss();
            finish();
          }
        });
    dialogInit.show();
  }
Пример #3
0
  @Override
  protected void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    String selection = l.getItemAtPosition(position).toString();

    selection = selection.replaceAll(" ", "_");

    dialog = new Dialog(SubExercise.this);
    dialog.setContentView(R.layout.instructions);
    dialog.setTitle("Exercise Instructions");
    dialog.setCancelable(true);

    Button close = (Button) dialog.findViewById(R.id.btnInstrCancel);
    TextView instr = (TextView) dialog.findViewById(R.id.lblReturnInstr);

    close.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });

    int res_id = getResources().getIdentifier(selection, "string", this.getPackageName());
    if (res_id != 0) {
      String instructions = getResources().getString(res_id);
      instr.setText(instructions);
    } else {
      instr.setText("Instructions Coming Soon!");
    }
    dialog.show();
  }
Пример #4
0
 public static Dialog showLoadFailedDialog(
     Context context, String message, final CommonDialogs.OnLoadFailedDialogCallback callback) {
   if (context == null) {
     return null;
   }
   Dialog dialog =
       CommonDialogs.simpleDialogBuilder(context)
           .setTitle("加载失败")
           .setMessage(message)
           .setNegativeButton(
               "返回上页",
               new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                   callback.onResult(false);
                 }
               })
           .setPositiveButton(
               "重新加载",
               new DialogInterface.OnClickListener() {
                 @Override
                 public void onClick(DialogInterface dialog, int which) {
                   callback.onResult(true);
                 }
               })
           .show();
   dialog.setCancelable(false);
   return dialog;
 }
  private void customDialoguGoster() {
    final Dialog dialog = new Dialog(CustomDialogActivity.this);
    dialog.setContentView(R.layout.custom_dialog_layout);
    dialog.setTitle("Title");
    dialog.setCancelable(false);

    final TextView tvCustomTextView = (TextView) dialog.findViewById(R.id.tvCustomTextView);
    tvCustomTextView.setText("Selam Gençler Keyifler Nasıl?");

    final Button bOkey = (Button) dialog.findViewById(R.id.bOkey);
    Button bCancel = (Button) dialog.findViewById(R.id.bCancel);

    bOkey.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            tvCustomTextView.setText("Demek ki okeymiş");
          }
        });

    bCancel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });

    dialog.show();
  }
Пример #6
0
  private void showUploadDialog() {
    // set up dialogVideoInfo

    dialogUpload.setCancelable(true);

    LinearLayout ll_upload = (LinearLayout) dialogUpload.findViewById(R.id.ll_upload);

    if (display.getWidth() > display.getHeight()) {
      ll_upload.getLayoutParams().width = display.getHeight();
      ll_upload.getLayoutParams().height = display.getHeight() / 2;
    } else {
      ll_upload.getLayoutParams().width = display.getWidth();
      ll_upload.getLayoutParams().height = display.getWidth() / 2;
    }

    // set up button
    RelativeLayout rl_recod_video = (RelativeLayout) dialogUpload.findViewById(R.id.rl_recod_video);
    rl_recod_video.setOnClickListener(
        new View.OnClickListener() {

          Intent intent;

          @Override
          public void onClick(View v) {
            intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
            intent.putExtra(
                MediaStore.EXTRA_VIDEO_QUALITY, 1); // set the video image quality to high
            intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 0);
            // start the Video Capture Intent
            startActivityForResult(intent, RECORD_VIDEO);
          }
        });
    RelativeLayout rl_pick_from_gallery =
        (RelativeLayout) dialogUpload.findViewById(R.id.rl_pick_from_gallery);
    rl_pick_from_gallery.setOnClickListener(
        new View.OnClickListener() {

          Intent intent;

          @Override
          public void onClick(View v) {
            intent = new Intent(Intent.ACTION_PICK, null);
            intent.setType("video/*");
            startActivityForResult(intent, 1);
          }
        });
    ImageView iv_close = (ImageView) dialogUpload.findViewById(R.id.iv_close);
    iv_close.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            finish();
            getActivityMediator().showMain();
          }
        });

    // now that the dialogVideoInfo is set up, it's time to show it
    dialogUpload.show();
  }
Пример #7
0
        public void onClick(View view) {
          final int position = Integer.parseInt(view.getTag().toString());
          final Dialog dialog = new Dialog(MenuActivity.this, R.style.TANCStyle);

          ImageView dishPicView;

          dialog.setContentView(R.layout.dish_detail);
          dishPicView = (ImageView) dialog.findViewById(R.id.dishBigPic);
          dialog.setCancelable(true);

          FileInputStream isBigPic = getPic(mDishes.getDish(position).getPic());
          if (isBigPic != null) {
            Bitmap photo = BitmapFactory.decodeStream(isBigPic);
            Drawable drawable = new BitmapDrawable(photo);
            dishPicView.setBackgroundDrawable(drawable);
          } else {
            dishPicView.setBackgroundResource(R.drawable.no_pic_bigl);
          }

          Button btnCancel = (Button) dialog.findViewById(R.id.btnCancel);
          btnCancel.setOnClickListener(
              new Button.OnClickListener() {
                public void onClick(View view) {
                  dialog.cancel();
                }
              });
          dialog.show();
        }
  /** Binds the android versions to the dropdrown pop up view */
  private void bindAndroidVersions() {
    hideToolTip();
    final Dialog dialog = new Dialog(AddDeviceActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.pop_up_android_versions);
    final ListView list = (ListView) dialog.findViewById(R.id.list);
    list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    final List<AndroidHistory> androidVersionList = mDbHelper.getAndroidVersions(" ASC ");
    AndroidVersionsAdapter adapter =
        new AndroidVersionsAdapter(
            ShowCaseApp.getAppContext(),
            R.layout.individual_row_android_versions,
            androidVersionList);
    list.setAdapter(adapter);
    list.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            list.setPressed(true);
            dialog.dismiss();
            mAndroidVersionId = androidVersionList.get(position).getAndroidId();
            mEtAndroidVersion.setText(androidVersionList.get(position).getName());
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
          }
        });
    dialog.setCancelable(true);
    dialog.show();
  }
Пример #9
0
  private void showDialog() {
    final Dialog dialog = new Dialog(getActivity());
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCancelable(true);
    dialog.setContentView(R.layout.dialog_version);

    TextView textView = (TextView) dialog.findViewById(R.id.dialog_text);
    textView.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View view) {
            dialog.dismiss();
          }
        });

    StringBuilder sb = new StringBuilder();
    sb.append(PhoneUtils.getApplicationName(getActivity()))
        .append("<br/>")
        .append("Version:")
        .append(PhoneUtils.getPackageInfo(getActivity()).versionName)
        .append("<br/>")
        .append("by <a href='")
        .append(Constants.GITHUB_NAME)
        .append("'>@Cundong</a>");

    CharSequence charSequence = Html.fromHtml(sb.toString());

    textView.setText(charSequence);
    textView.setMovementMethod(LinkMovementMethod.getInstance());

    dialog.show();
  }
Пример #10
0
 /*package*/ void onPrepareDialog(int id, Dialog d, Bundle options) {
   switch (id) {
     case DIALOG_PROGRESS:
       d.setCancelable(options.getBoolean(KEY_DIALOG_PROGRESS_CANCELABLE, true));
       d.setOnCancelListener(null);
   }
 }
Пример #11
0
 public void XOA_MAU(final Obj_MAU_CANVAS MCV) {
   final Dialog dialog = new Dialog(activity, R.style.FullHeightDialog);
   dialog.setContentView(R.layout.dialog_yes_no);
   dialog.setCancelable(true);
   TextView message = (TextView) dialog.findViewById(R.id.tvmessagedialogtext);
   message.setText(
       activity.getString(R.string.xoa_mau_dang_chon)
           + " "
           + MCV.TEN_MAU
           + " "
           + activity.getString(R.string.khong_));
   Button yes = (Button) dialog.findViewById(R.id.bmessageDialogYes);
   yes.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           try {
             mdb.delete_MAU_CANVAS(MCV);
             ARR_list.remove(MCV);
             notifyDataSetChanged();
           } catch (Exception e) {
             ThtShow.show_crouton_toast(activity, e.toString(), tht.library.crouton.Style.ALERT);
           }
           dialog.dismiss();
         }
       });
   Button no = (Button) dialog.findViewById(R.id.bmessageDialogNo);
   no.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           dialog.dismiss();
         }
       });
   dialog.show();
 }
Пример #12
0
  public static Dialog showProgressDialog(Context mContext, String text, boolean cancelable) {
    Dialog mDialog = new Dialog(mContext, R.style.ProgressBarTheme);
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    LayoutInflater mInflater = LayoutInflater.from(mContext);
    mDialog
        .getWindow()
        .setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    View layout = mInflater.inflate(R.layout.custom_progressbar, null);
    mDialog.setContentView(layout);

    TextView tvProgressMessage = (TextView) layout.findViewById(R.id.tvProgressMessage);

    if (text.equals("")) tvProgressMessage.setVisibility(View.GONE);
    else tvProgressMessage.setText(text);

    mDialog.setCancelable(cancelable);
    mDialog.setCanceledOnTouchOutside(false);
    /*
     * mDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND
     * );
     */
    mDialog.show();

    return mDialog;
  }
Пример #13
0
 public void xoa_1_mau(View v) {
   if (MAU_CHON.equals("null")) {
     Custom_Toast.show_yellow_toast(Ac_xem_vattu.this, "Không thể xoá tất cả");
   } else {
     final Dialog dialog = new Dialog(this, R.style.FullHeightDialog);
     dialog.setContentView(R.layout.dialog_yes_no);
     dialog.setCancelable(true);
     TextView message = (TextView) dialog.findViewById(R.id.tvmessagedialogtext);
     message.setText(getString(R.string.xoa_mau_dang_chon));
     Button yes = (Button) dialog.findViewById(R.id.bmessageDialogYes);
     yes.setOnClickListener(
         new OnClickListener() {
           public void onClick(View v) {
             try {
               mdb.delete_MAU_VATTU(MAU_CHON);
               set_spinner_mau_vattu();
               Custom_Toast.show_blue_toast(Ac_xem_vattu.this, "Xoá mẫu thành công !");
             } catch (Exception e) {
               ThtShow.show_crouton_toast(Ac_xem_vattu.this, e.toString(), Style.ALERT);
             }
             dialog.dismiss();
           }
         });
     Button no = (Button) dialog.findViewById(R.id.bmessageDialogNo);
     no.setOnClickListener(
         new OnClickListener() {
           public void onClick(View v) {
             dialog.dismiss();
           }
         });
     dialog.show();
   }
 }
Пример #14
0
  public static Dialog createLoadingDialog(
      Context context, String msg, int be_downloaded_byte, int total_byte, boolean cancelable) {

    LayoutInflater inflater = LayoutInflater.from(context);

    // load dialog layout
    View view = inflater.inflate(R.layout.loading_dialog, null);
    // load layout linear
    LinearLayout layout = (LinearLayout) view.findViewById(R.id.download_dialog);

    if (be_downloaded_byte != NON_DOWNLOAD_TAG) {
      ImageView running = (ImageView) view.findViewById(R.id.loading_image);
      running.setImageResource(R.drawable.taipower_boy1_running1);

      TextView loading_percent = (TextView) view.findViewById(R.id.loading_data_progress);
      loading_percent.setText(
          String.valueOf(be_downloaded_byte) + "/" + String.valueOf(total_byte));
    } else {
      // load layout ImageView
      ImageView cycle_image_view = (ImageView) view.findViewById(R.id.loading_image);

      // mount animation
      Animation hyperspaceJumpAnimation =
          AnimationUtils.loadAnimation(context, R.anim.loading_animation);

      // ImageView to animation
      cycle_image_view.startAnimation(hyperspaceJumpAnimation);
    }

    TextView loading_text = (TextView) view.findViewById(R.id.loading_text);
    loading_text.setText(msg);

    // new dialog
    Dialog loadingDialog = new Dialog(context, R.style.loading_style);
    // Dialog loadingDialog = new Dialog(context);
    loadingDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

    loadingDialog.setCancelable(false);
    loadingDialog.setContentView(
        view,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

    if (cancelable) {
      loadingDialog.setOnKeyListener(
          new DialogInterface.OnKeyListener() {
            @Override
            public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
              // TODO Auto-generated method stub
              if (keyCode == KeyEvent.KEYCODE_BACK) dialog.dismiss();

              return false;
            }
          });
    }

    loadingDialog.show();

    return loadingDialog;
  }
Пример #15
0
  private void dialog() {

    LayoutInflater inflater = LayoutInflater.from(activity);
    RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.exit_dialog, null);

    dialog = new AlertDialog.Builder(activity).create();
    dialog.setCancelable(false);
    dialog.show();
    dialog.getWindow().setContentView(layout);

    Button exit_cancel = (Button) layout.findViewById(R.id.exit_cancel);
    Button drop_out = (Button) layout.findViewById(R.id.drop_out);

    drop_out.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
            activity.finish();
          }
        });
    exit_cancel.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            dialog.dismiss();
          }
        });
  }
Пример #16
0
  /** [Give the description for method]. */
  public void showDialog() {
    mDialog = new Dialog(context);
    mDialog.setTitle("");
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setContentView(R.layout.dialog_gps);
    mDialog.setCancelable(true);
    LinearLayout chat = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_chat);
    LinearLayout info = (LinearLayout) mDialog.findViewById(R.id.line_dialog_gps_info);
    chat.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent i = new Intent(context, ChatActivity.class);
            context.startActivity(i);
          }
        });
    info.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Intent i = new Intent(context, ChatActivity.class);
            context.startActivity(i);
          }
        });
    mDialog.show();
  }
Пример #17
0
  /**
   * * showProcessHUD 显示进度指示
   *
   * @param title 显示提示title
   */
  protected void showProcessHUD(String title) {
    // 加载进度条
    LayoutInflater inflater = LayoutInflater.from(getActivity());
    View v = inflater.inflate(R.layout.ztb_custom_dialog, null);
    ImageView spaceshipImage = (ImageView) v.findViewById(R.id.dialog_loading_img);
    TextView titleTV = (TextView) v.findViewById(R.id.dialog_loading_title);
    if (!TextUtils.isEmpty(title)) {
      titleTV.setText(title);
      titleTV.setVisibility(View.VISIBLE);
    } else {
      titleTV.setVisibility(View.GONE);
    }
    Animation hyperspaceJumpAnimation =
        AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_anim);
    spaceshipImage.startAnimation(hyperspaceJumpAnimation);

    mPD = new Dialog(getActivity(), R.style.loading_dialog);
    mPD.addContentView(
        v,
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

    mPD.setCancelable(true);
    mPD.setCanceledOnTouchOutside(false);
    mPD.show();
  }
  void showAlertWithDeleteMessage(String message, Context context, final DBNoteItems dbNoteItems) {

    final Dialog dialog = new Dialog(context);

    LayoutInflater inflater =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    // inflate your activity layout here!
    View contentView = inflater.inflate(R.layout.alert_view, null, false);

    TextView textViewTitleAlert = (TextView) contentView.findViewById(R.id.textViewTitleAlert);
    textViewTitleAlert.setText("" + dbNoteItems.getNote_Title());
    textViewTitleAlert.setTextColor(Color.WHITE);
    TextView textViewTitleAlertMessage =
        (TextView) contentView.findViewById(R.id.textViewTitleAlertMessage);
    textViewTitleAlertMessage.setText(message);

    Button buttonAlertCancel = (Button) contentView.findViewById(R.id.buttonAlertCancel);
    Button buttonAlertOk = (Button) contentView.findViewById(R.id.buttonAlertOk);
    buttonAlertCancel.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            dialog.dismiss();
          }
        });
    buttonAlertOk.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            // TODO Auto-generated method stub

            boolean status = androidOpenDbHelperObj.deleteNote(dbNoteItems.getNote_Id());
            if (status == true) {

              Toast.makeText(
                      FolderNoteListMainActivity.this,
                      "Note deleted successfully",
                      Toast.LENGTH_SHORT)
                  .show();
              getallNotes();
            } else {
              Toast.makeText(
                      FolderNoteListMainActivity.this,
                      "Note deleted unsuccessfully",
                      Toast.LENGTH_SHORT)
                  .show();
            }
            dialog.dismiss();
          }
        });

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setCancelable(false);
    dialog.setContentView(contentView);
    dialog.show();
  }
Пример #19
0
 @Override
 public void onBackPressed() {
   if (mainExit) {
     Utils.killProcess(mContext);
   } else {
     super.setCancelable(true);
   }
 }
Пример #20
0
  public boolean onOptionsItemSelected(MenuItem item) {
    Context myContext = this;
    switch (item.getItemId()) {
      case R.id.about:
        final Dialog aboutDialog = new Dialog(myContext);
        aboutDialog.setContentView(R.layout.about);
        aboutDialog.setTitle("About");
        aboutDialog.setCancelable(true);

        TextView text = (TextView) aboutDialog.findViewById(R.id.aboutText);
        text.setText("Application done by Group6, v0.02 (beta)");
        aboutDialog.show();
        break;
      case R.id.help:
        final Dialog helpDialog = new Dialog(myContext);
        helpDialog.setContentView(R.layout.help);
        helpDialog.setTitle("Help");
        helpDialog.setCancelable(true);

        text = (TextView) helpDialog.findViewById(R.id.Text);
        /*
         * "Run f****t run!" kanske borde sparas i filen strings istället?
         */
        text.setText(
            "Run towards the flags, when you get close to a flag it will turn green and you can continue to the next one");

        Button button = (Button) helpDialog.findViewById(R.id.cancel);
        button.setOnClickListener(
            new OnClickListener() {

              public void onClick(View v) {
                helpDialog.dismiss();
              }
            });
        helpDialog.show();
        break;
      case R.id.newG:
        Intent myIntent = new Intent(this, AppActivity.class);
        this.startActivity(myIntent);
        break;
      default:
        break;
    }
    return false;
  }
Пример #21
0
 // 自定义加载对话框
 private void progressDialog(String title) {
   progressDialog = new Dialog(IndexActivity.this, R.style.progress_dialog);
   progressDialog.setContentView(R.layout.dialog);
   progressDialog.setCancelable(true);
   progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
   TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
   msg.setText(title);
   progressDialog.show();
 }
Пример #22
0
 /*自定义加载条*/
 public Dialog ProgressDialog(Dialog progressDialog, String val) {
   progressDialog = new Dialog(mContext, R.style.progress_dialog);
   progressDialog.setContentView(R.layout.progress_dialog);
   progressDialog.setCancelable(false);
   progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
   TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
   msg.setText(val);
   return progressDialog;
 }
Пример #23
0
  /**
   * User clicked clock in. If the user has setting to auto clock in then just clock in. Otherwise
   * open dialog to choose time.
   */
  private void clickedClockIn() {
    if (sp.getBoolean(Constants.PREFS_AUTO_CLOCK_IN, false)) {
      startNewClock(true);
    } else {
      final Dialog dialog = new Dialog(this);
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      dialog.setContentView(R.layout.layout_clock_in);
      Button btnCancel = (Button) dialog.findViewById(R.id.btnCancel);
      Button btnNow = (Button) dialog.findViewById(R.id.btnClockInNow);
      Button btnOffset = (Button) dialog.findViewById(R.id.btnClockInOffset);
      TextView adress = (TextView) dialog.findViewById(R.id.twAdress);

      adress.setTypeface(abel);
      btnNow.setTypeface(abel);
      btnOffset.setTypeface(abel);
      btnCancel.setTypeface(abel);
      btnCancel.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              dialog.dismiss();
            }
          });
      btnNow.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              startNewClock(false);
              dialog.dismiss();
            }
          });
      btnOffset.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              startNewClock(true);
              dialog.dismiss();
            }
          });
      twAdress = (TextView) dialog.findViewById(R.id.twClockInAdress);
      twHint = (TextView) dialog.findViewById(R.id.hint);
      twHint.setTypeface(abel);
      twAdress.setTypeface(abel);
      Log.d(TAG, "nhood:" + myCurrentNeighborHood + " and:" + myCurrentAdress);
      if (!myCurrentNeighborHood.equalsIgnoreCase(myCurrentAdress)
          || myCurrentNeighborHood != null) {
        twAdress.setText(myCurrentAdress + "\n" + myCurrentNeighborHood);
      } else {
        twAdress.setText(myCurrentAdress);
      }
      dialog.setCancelable(false);
      dialog.show();
    }
  }
Пример #24
0
  private Dialog showZoomDialog() {
    Dialog zoomedDialog = new Dialog(SyncResultsActivity.this);
    zoomedDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    zoomedDialog.setContentView(R.layout.zoomedpic);
    zoomedDialog.setCancelable(true);

    final ImageView image = (ImageView) zoomedDialog.findViewById(R.id.image);

    final int padding = 15;

    final int width = mContactImage.getWidth();
    final int height = mContactImage.getHeight();

    int newWidth = width;
    int newHeight = height;

    final int windowHeight = getWindowManager().getDefaultDisplay().getHeight();
    final int windowWidth = getWindowManager().getDefaultDisplay().getWidth();

    boolean scale = false;
    float ratio;

    if (newHeight >= windowHeight) {
      ratio = (float) newWidth / (float) newHeight;
      newHeight = windowHeight - padding;
      newWidth = Math.round(ratio * (float) newHeight);

      scale = true;
    }

    if (newWidth >= windowWidth) {
      ratio = (float) newHeight / (float) newWidth;
      newWidth = windowWidth - padding;
      newHeight = Math.round(ratio * (float) newWidth);

      scale = true;
    }

    image.setImageBitmap(mContactImage);

    if (scale) {
      Matrix m = new Matrix();
      m.postScale((float) newWidth / (float) width, (float) newHeight / (float) height);
      image.setImageMatrix(m);

      zoomedDialog.getWindow().setLayout(newWidth, newHeight);
    }

    zoomedDialog.setOnCancelListener(
        new OnCancelListener() {
          public void onCancel(DialogInterface dialog) {
            removeDialog(ZOOM_PIC);
          }
        });

    return zoomedDialog;
  }
  @Override
  public boolean onMenuItemSelected(int featureId, MenuItem item) {
    switch (item.getItemId()) {
      case R.id.moreinfo:
        Intent browserIntent =
            new Intent(Intent.ACTION_VIEW, Uri.parse("http://en.wikipedia.org/wiki/Karnaugh_map"));
        startActivity(browserIntent);
        break;
      case R.id.var3:
        KMapControl = new KMapController(KMapController.VARIABLE_3);
        createLinear();
        break;
      case R.id.var4:
        KMapControl = new KMapController(KMapController.VARIABLE_4);
        createLinear();
        break;
      case R.id.var5:
        KMapControl = new KMapController(KMapController.VARIABLE_5);
        createLinear();
        break;
      case R.id.vieweq:
        final Dialog dialog = new Dialog(this);
        dialog.setContentView(R.layout.vieweq);
        dialog.setTitle("Quine–McCluskey Algorithm");
        dialog.setCancelable(true);

        TextView text = (TextView) dialog.findViewById(R.id.TextView01);
        String EQ = "";
        String REQ = "";
        try {
          EQ = KMapControl.getEquation();
          REQ = KMapControl.getReducedEquation();
          if (REQ == "") {
            REQ = "1";
          }
        } catch (Exception e) {
          REQ = "0";
        }

        text.setText("\nEquation:\n" + EQ + "\n\nReduced Equation:\n" + REQ + "\n\n");

        Button button = (Button) dialog.findViewById(R.id.Button01);
        button.setText("Close");
        button.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                dialog.cancel();
              }
            });
        dialog.show();
        break;
    }
    return true;
  }
Пример #26
0
  public void showUpdateDialog() {
    final Dialog dialog = new Dialog(getActivity());
    dialog.setContentView(R.layout.edit_user_info);
    dialog.setCancelable(true);

    updateProfileTV = (TextView) dialog.findViewById(R.id.udpateProfileTV);
    phoneNumberUpd = (TextView) dialog.findViewById(R.id.phoneNumberUpd);
    errorTxtUpt = (TextView) dialog.findViewById(R.id.errorTxtUpt);
    nameUpd = (EditText) dialog.findViewById(R.id.nameUpd);
    eMailUpd = (EditText) dialog.findViewById(R.id.eMailUpd);
    addressETUpd = (EditText) dialog.findViewById(R.id.addressETUpd);
    save = (Button) dialog.findViewById(R.id.saveUpt);

    phoneNumberUpd.setText(databaseHandler.getUser(1).getMsisdn());
    nameUpd.setText(databaseHandler.getUser(1).getName());
    eMailUpd.setText(databaseHandler.getUser(1).getEmail());
    addressETUpd.setText(databaseHandler.getRegister(1).getAddress());
    save.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Hit here to update
            if (carFunctions.isConnectingToInternet()) {
              new UpdateProfile(
                      databaseHandler.getUser(1).getMsisdn(),
                      eMailUpd.getText().toString(),
                      nameUpd.getText().toString(),
                      addressETUpd.getText().toString())
                  .execute();
              // getActivity().finish();
              // Intent intent = new Intent(getActivity(), getActivity()
              // .getClass());
              // intent.putExtra("fragNum", "0");
              // getActivity().startActivity(intent);
            } else {
              Toast.makeText(getActivity(), "Check your internet connection", Toast.LENGTH_LONG)
                  .show();
            }
            dialog.dismiss();
          }
        });

    if (setting.getDuration() == 1) {
      dialog.setTitle(getResources().getString(R.string.update_profile_ar));
      updateProfileTV.setText(getResources().getString(R.string.update_profile_ar));
      save.setText(getResources().getString(R.string.save_ar));
    } else {
      dialog.setTitle(getResources().getString(R.string.update_profile_en));
      updateProfileTV.setText(getResources().getString(R.string.update_profile_en));
    }

    dialog.show();
  }
Пример #27
0
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(getActivity());
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.setCanceledOnTouchOutside(true);
    dialog.setCancelable(false);
    createContentView(dialog);

    return dialog;
  }
Пример #28
0
  private void showUploadSuccessDialog() {
    // set up dialogVideoInfo
    dialogUploadSuccess.setCancelable(true);
    state = 0;
    ImageView iv_thumb = (ImageView) dialogUploadSuccess.findViewById(R.id.iv_thumb);

    LinearLayout ll_video_info =
        (LinearLayout) dialogUploadSuccess.findViewById(R.id.ll_upload_success);
    if (display.getWidth() > display.getHeight()) {
      ll_video_info.getLayoutParams().width = display.getHeight();
      ll_video_info.getLayoutParams().height = (int) Math.round((float) display.getHeight() * 0.7);
    } else {
      ll_video_info.getLayoutParams().width = (int) Math.round((float) display.getWidth() * 0.7);
      ll_video_info.getLayoutParams().height = (int) Math.round((float) display.getHeight() * 0.6);
      iv_thumb.getLayoutParams().height = (int) Math.round((float) display.getHeight() * 0.6) / 2;
    }

    Bitmap bMap =
        ThumbnailUtils.createVideoThumbnail(
            Main.this.pathfromURI, MediaStore.Video.Thumbnails.MICRO_KIND);
    iv_thumb.setScaleType(ImageView.ScaleType.CENTER_CROP);
    iv_thumb.setImageBitmap(bMap);

    // set up button
    ImageView iv_close = (ImageView) dialogUploadSuccess.findViewById(R.id.iv_close);
    iv_close.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            finish();
            getActivityMediator().showMain();
          }
        });

    Button btn_upload_successfully =
        (Button) dialogUploadSuccess.findViewById(R.id.btn_upload_successfully);
    btn_upload_successfully.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
            finish();
            getActivityMediator().showMain();
          }
        });

    // now that the dialogVideoInfo is set up, it's time to show it
    dialogUploadSuccess.show();
  }
  // Crea il particolare dialog una volta sola
  // Per riconfigurarlo usare onPrepareDialog
  protected Dialog onCreateDialog(int id) {
    final Dialog dialog;
    switch (id) {
      case DIALOG_EXIT_APPLICATION:
        // prepare the custom dialog
        dialog = new Dialog(this); // con l'app context non si aprono
        dialog.setCancelable(false);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.exit_application_dialog);
        // dialog.setTitle("Custom Dialog");
        dialog.getWindow().setBackgroundDrawableResource(R.drawable.dialogbg);

        TextView textExit = (TextView) dialog.findViewById(R.id.textexit);
        textExit.setTypeface(FontFactory.getFont1(getApplicationContext()));

        final ImageView yesButton = (ImageView) dialog.findViewById(R.id.yesButton);
        yesButton.setOnTouchListener(
            new OnTouchListener() {
              public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                  case MotionEvent.ACTION_UP:
                    yesButton.setEnabled(false);
                    dialog.dismiss();
                    finish();
                    overridePendingTransition(0, 0);
                    break;
                }
                return true;
              }
            });

        final ImageView noButton = (ImageView) dialog.findViewById(R.id.noButton);
        noButton.setOnTouchListener(
            new OnTouchListener() {
              public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                  case MotionEvent.ACTION_UP:
                    noButton.setEnabled(false);
                    waiting = false;
                    noButton.setEnabled(true);
                    dialog.dismiss();
                    break;
                }
                return true;
              }
            });
        break;
      default:
        dialog = null;
    }
    return dialog;
  }
Пример #30
0
  /*
   * 显示loading dialog
   */
  public static void showProgressDialog(Context context) {

    if (progressDialog == null) {
      progressDialog = new Dialog(context, R.style.progress_dialog);
      progressDialog.setContentView(R.layout.progress_dialog);
      progressDialog.setCancelable(true);
      progressDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
      TextView msg = (TextView) progressDialog.findViewById(R.id.id_tv_loadingmsg);
      msg.setText("卖力加载中");
      progressDialog.setCanceledOnTouchOutside(false);
    }
    progressDialog.show();
  }