public boolean onContextItemSelected(MenuItem item) {
    switch (item.getItemId()) {
      case 1:
        mBtn.setTextColor(Color.RED);
        return true;
      case 2:
        mBtn.setTextColor(Color.GREEN);
        return true;
      case 3:
        mBtn.setTextColor(Color.BLUE);
        return true;
      case 4:
        Toast.makeText(this, "번역했다.", Toast.LENGTH_SHORT).show();
        return true;
      case 5:
        Toast.makeText(this, "필기 인식했다.", Toast.LENGTH_SHORT).show();
        return true;
      case 100:
        Toast.makeText(this, "회전했다 치고.", Toast.LENGTH_SHORT).show();
        return true;
      case 101:
        Toast.makeText(this, "크기 변경 했다 치고.", Toast.LENGTH_SHORT).show();
        return true;
    }

    return true;
  }
  public MapView(Context ctx, boolean allowNetAccess, int mode) {
    super(ctx);

    Display display;

    this.allowNetAccess = allowNetAccess;

    geoUtils = new GeoUtils(mode);

    setBackgroundColor(0xFF555570);
    display = ((WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
    scrWidth = display.getWidth();
    scrHeight = display.getHeight();
    setMinimumHeight(scrWidth);
    setMinimumWidth(scrHeight);
    tileWidth = (int) Math.ceil(scrWidth / 256.0) + 1;
    tileHeight = (int) Math.ceil(scrHeight / 256.0) + 1;
    gestureDetector = new GestureDetector(ctx, new GestureListener());

    zoomOutButton = new Button(ctx);
    zoomOutButton.setText("  -  ");
    zoomOutButton.setOnClickListener(this);

    zoomInButton = new Button(ctx);
    zoomInButton.setText("  +  ");
    zoomInButton.setOnClickListener(this);

    updateUI(true);
    addView(zoomOutButton);
    addView(zoomInButton);
  }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.rss_reader);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);

    btnManage = (Button) findViewById(R.id.btn_manage);
    btnBrowse = (Button) findViewById(R.id.btn_browse);
    btnRefresh = (Button) findViewById(R.id.btn_refresh);
    btnSearch = (Button) findViewById(R.id.btn_search);

    btnManage.setOnClickListener(this);
    btnBrowse.setOnClickListener(this);
    btnRefresh.setOnClickListener(this);
    btnSearch.setOnClickListener(this);

    txtSearch = (EditText) findViewById(R.id.txt_search);

    init();

    boolean hasUpdate = false;
    try {
      hasUpdate = getIntent().getExtras().getBoolean("rss_update");
    } catch (NullPointerException e) {
      e.printStackTrace();
    }

    if (hasUpdate) {
      rssFeed = dbQuery.getUpdatedRssFeed();
      updateListView();
    } else loadData(null, true, false, true);
  }
  private void InitViews() {
    edSubject = (TouchEdit) findViewById(R.id.edCourseSubject);
    btnStartDate = (Button) findViewById(R.id.btnCourseStartDate);
    btnStartTime = (Button) findViewById(R.id.btnCourseStartTime);
    btnStartDate.setVisibility(ImageButton.VISIBLE);
    btnRepeatSelect = (Button) findViewById(R.id.btnRepeatSelect);
    btnRepeatSelect.setVisibility(ImageButton.INVISIBLE);
    btnStartDate.setVisibility(ImageButton.GONE);

    btnSave = (ImageButton) findViewById(R.id.btnCourseSave);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            SaveData();
          }
        });

    btnDelete = (ImageButton) findViewById(R.id.btnCourseDelete);
    btnDelete.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            DeleteData();
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    //
    //	this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.main_login);

    mEtAccount = (EditText) findViewById(R.id.mainLoginEditAccount);
    mEtPassword = (EditText) findViewById(R.id.mainLoginEditPassword);
    mBtnLogin = (Button) findViewById(R.id.mainLoginBtn);
    mBtnRegister = (Button) findViewById(R.id.main_btn_register);

    /* this is to render the password edittext font to be default */
    mEtPassword.setTypeface(Typeface.DEFAULT);
    mEtPassword.setTransformationMethod(new PasswordTransformationMethod());

    mBtnLogin.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            MainActivity.this.tryLogin();
          }
        });

    mBtnRegister.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            Intent intent0 = new Intent(MainActivity.this, RegisterActivity.class);
            startActivity(intent0);
          }
        });
  }
 private void UpdateStartDateTimeView() {
   btnStartDate.setText(AnCalDateUtils.formatMediumDate(this, dateStart));
   if (chkAllDay.isChecked()) {
     btnStartTime.setText(utils.GetResStr(R.string.labNoTime));
   } else {
     btnStartTime.setText(AnCalDateUtils.formatTime(this, dateStart));
   }
 }
 @Override
 public void onClick(View inButton) {
   boolean isErr = false;
   if (mTitle.getText().toString().length() == 0) {
     mTitle.setError("Required");
     mTitle.setEms(10);
     isErr = true;
   }
   if (mDesc.getText().toString().length() == 0) {
     mDesc.setActivated(true);
     mDesc.setError("Required");
     isErr = true;
   }
   if (inButton.getId() == openWeb.getId()) web.setVisibility(View.VISIBLE);
   else if (inButton.getId() == mAvail.getId())
     startActivity(new Intent(this, CheckActivity.class));
   else if (inButton.getId() == mBack.getId()) finish();
   else if (inButton.getId() == mSub.getId()) {
     AlertDialog.Builder al = new AlertDialog.Builder(this);
     if (isErr) return;
     else
       al.setTitle("Continue?")
           .setIcon(R.drawable.ornament)
           .setMessage("Your listing is going to be submitted to your chosen category.")
           .setPositiveButton(
               "OK",
               new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface d, int x) {
                   payment = new ArrayList<String>();
                   if (mCard.isChecked()) payment.add("Card");
                   if (mCheck.isChecked()) payment.add("Check");
                   if (mOnline.isChecked()) payment.add("Online");
                   if (mCash.isChecked()) payment.add("Cash");
                   //			Toast.makeText(getApplicationContext(), payment.toString(),
                   // Toast.LENGTH_LONG).show();
                   Intent intent = new Intent(getApplicationContext(), StartActivity.class);
                   intent.putExtra("Payment", payment);
                   intent.putExtra("Category", mChosenCategory);
                   intent.putExtra("Title", mTitle.getText().toString());
                   intent.putExtra("Price", mPrice.getText().toString());
                   intent.putExtra("Description", mDesc.getText().toString());
                   intent.putExtra("Location", mLocation.getText().toString());
                   intent.putExtra("Photo", jpegData);
                   startActivity(intent);
                 }
               })
           .setNegativeButton(
               "Cancel",
               new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface d, int x) {}
               })
           .show();
   } else
     startActivityForResult(
         new Intent(this, com.lightbox.android.camera.activities.Camera.class), REQ);
 }
  private void updateUI(boolean inProgress) {
    buttonStart.setEnabled(!inProgress);
    buttonStop.setEnabled(inProgress);

    if (inProgress) {
      progressBar.setVisibility(View.VISIBLE);
    } else {
      progressBar.setVisibility(View.INVISIBLE);
    }
  }
Example #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_ejemplo);

    textView = (TextView) findViewById(R.id.textView1);
    Button button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(this);
    Locale locale = Locale.getDefault();
    Locale locale1 = getResources().getConfiguration().locale;
    Log.d("EjemploActivity", "El locale es: ".concat(locale.toString()));
    Log.d("EjemploActivity", "El locale1 es: ".concat(locale1.toString()));
  }
 public void setNextButton() {
   Button meatButton = (Button) findViewById(R.id.meatToppingsButton);
   meatButton.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(MeatToppingsActivity.this, NameActivity.class);
           intent.putExtra("size", size);
           intent.putExtra("numVeggieToppings", numVeggieToppings);
           intent.putExtra("numMeatToppings", numMeatToppings);
           startActivity(intent);
         }
       });
 }
  public void showDetails(Equipment equipment) {
    equip = equipment;
    View view;
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      view = getActivity().findViewById(R.id.detail_frag);
    } else {
      view = getActivity().findViewById(R.id.main_frame);
      Button button = (Button) view.findViewById(R.id.closeButton);
      button.setVisibility(View.VISIBLE);
    }

    TextView textIt_no = (TextView) view.findViewById(R.id.it_no2);
    TextView textType = (TextView) view.findViewById(R.id.type2);
    TextView textBrand = (TextView) view.findViewById(R.id.brand2);
    TextView textModel = (TextView) view.findViewById(R.id.model2);
    TextView textE_id = (TextView) view.findViewById(R.id.e_id);
    TextView textDescription = (TextView) view.findViewById(R.id.description);
    TextView textAquired = (TextView) view.findViewById(R.id.aquired);

    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizeLandscape);
    } else {
      textIt_no.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textType.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textBrand.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textAquired.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textModel.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textDescription.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
      textE_id.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSizePortrait);
    }
    textIt_no.setText("Item nr: \t\t\t\t" + equipment.getIt_no());
    textType.setText("Type: \t\t\t\t\t" + equipment.getType());
    textBrand.setText("Brand: \t\t\t\t" + equipment.getBrand());
    textModel.setText("Model: \t\t\t\t" + equipment.getModel());
    textE_id.setText("Equipment ID: \t" + equipment.getE_id());
    textDescription.setText("Description: \t" + equipment.getDescription());
    textAquired.setText("Aquired: \t\t\t" + equipment.getAquired());

    downloadImageThread();

    ImageView image = (ImageView) view.findViewById(R.id.equipment_image);
    image.setImageBitmap(bitmap);
  }
Example #12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add);
    // almacenando valores ingresados por el usuario
    nombre = (EditText) findViewById(R.id.edit_name);
    ciudad = (EditText) findViewById(R.id.edit_city);
    // declarando a los botones
    final Button agregar = (Button) findViewById(R.id.yes_b);
    // final Button cancelar = (Button)findViewById(R.id.btnCancelar);
    // acción cuando le dan click al boton agregar
    agregar.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            // se realiza el intento de enviar los datos de un activity a otro, de Registro a
            // Salida.
            // Intent intent = new Intent(RegistroLibroActivity.this, SalidaResultado.class);
            // Bundle b = new Bundle();
            // almacenamiento temporal para poder usarlo en otro activity
            String bnombre = String.valueOf(nombre.getText());
            String bciudad = String.valueOf(ciudad.getText());

            nombre.setText("");
            ciudad.setText("");

            // llamada al metodo para insertar los datos.
            insertPrso(bnombre, bciudad);
            // datos que seran vistos en el otro main
            // b.putString("T", btitulo);
            // b.putString("A", bautor);
            // b.putString("I", bidioma);
            // b.putString("B", baño);
            // intent.putExtras(b);
            // startActivity(intent);
          }
        });
    // acción cuando le dan click al boton agregar
    // cancelar.setOnClickListener(new View.OnClickListener() {
    //   public void onClick(View v) {
    //     titulo.setText(" ");
    //   autor.setText(" ");
    // idioma.setText(" ");
    // año.setText(" ");
    // }
    // });
  }
  protected void setupUI() {
    buttonStart.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            startTranscode();
          }
        });

    buttonStop.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            stopTranscode();
          }
        });
  }
Example #14
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    c = this;
    preferences = PreferenceManager.getDefaultSharedPreferences(c);

    super.onCreate(savedInstanceState);

    setContentView(R.layout.gpu_sgx540);

    gpuCurrent = readFile(Constants.GPU_SGX540);
    seekGpu = (SeekBar) findViewById(R.id.seek_gpu);

    gpu = Arrays.asList(153, 307, 384);
    seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent));

    /*else{
    seekGpu.setEnabled(false);
    seekIva.setEnabled(false);
    TextView ns = (TextView)findViewById(R.id.not_supported);
    ns.setVisibility(View.VISIBLE);
    }*/
    preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext());

    curGpuTxt = (TextView) findViewById(R.id.current_gpu);
    maxGpuTxt = (TextView) findViewById(R.id.max_gpu);
    minGpuTxt = (TextView) findViewById(R.id.min_gpu);

    mhz = getResources().getString(R.string.mhz);
    current = getResources().getString(R.string.current);
    max = getResources().getString(R.string._max);
    min = getResources().getString(R.string._min);
    curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz);
    maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz);
    minGpuTxt.setText(min + ": " + gpu.get(0) + mhz);

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

          @Override
          public void onClick(View arg0) {
            finish();
          }
        });
  }
    @Override
    public DownloadStreamTask(Context _c) {
      mContext = new WeakReference<Context>(_c);
      // dialog = new ProgressDialog(myact.this);

      text1 = (TextView) findViewById(R.id.textView1);

      Button cancelbtn = (Button) findViewById(R.id.ButtonCancel);
      cancelbtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              // Do something in response to button click
              cancel(true);
            }
          });

      cancelbtn.setEnabled(true);
    }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.receiver);

    final Button cancelbtn = (Button) findViewById(R.id.ButtonCancel);
    // cancelbtn.setEnabled(false);
    cancelbtn.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // streamtask.cancel(true);
            finish();
          }
        });

    try {
      Intent intent = getIntent();
      String action = intent.getAction();
      String type = intent.getType();

      if ((!(Intent.ACTION_SEND.equals(action))) || (type == null)) {
        throw new RuntimeException("Unknown intent action or type");
      }

      if (!("text/plain".equals(type))) {
        throw new RuntimeException("Type is not text/plain");
      }

      String extra = intent.getStringExtra(Intent.EXTRA_TEXT);
      if (extra == null) {
        throw new RuntimeException("Cannot get shared text");
      }

      final DownloadStreamTask streamtask = new DownloadStreamTask(this);

      //	Once created, a task is executed very simply:
      streamtask.execute(extra);

    } catch (Exception e) {
      Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
    }
  }
  /** Configure the common answer field. Not called automatically. Do it in setupGameActions(). */
  protected void setupAnswerActions(int fieldID, int buttID) {
    final EditText fieldAnswer = (EditText) findViewById(fieldID);
    final Button buttAnswer = (Button) findViewById(buttID);

    fieldAnswer.addTextChangedListener(
        new TextWatcherAdapter() {
          public void afterTextChanged(Editable ed) {
            buttAnswer.setClickable((ed.length() > 0));
          };
        });

    buttAnswer.setClickable(false);
    buttAnswer.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            onAnswer();
          }
        });
  }
  private void showDeleteDialog() {
    Log.d(TAG, "showDeleteDialog() called");

    final Dialog deleteDialog = new Dialog(NoteActivity.this);
    LinearLayout dialogLayout =
        (LinearLayout) View.inflate(NoteActivity.this, R.layout.delete_note_dialog, null);
    deleteDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    deleteDialog.setContentView(dialogLayout);

    WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
    lp.copyFrom(deleteDialog.getWindow().getAttributes());
    lp.width = WindowManager.LayoutParams.MATCH_PARENT;

    deleteDialog.show();
    deleteDialog.getWindow().setAttributes(lp);

    TextView noteTitleTextView =
        (TextView) dialogLayout.findViewById(R.id.delete_note_dialog_delete_note_title_textview);
    noteTitleTextView.setText(note.getTitle());

    Button confirmDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_confirm_button);
    confirmDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog confirm button clicked");
            noteProvider.deleteNote(note);
            finish();
          }
        });

    Button cancelDeleteButton =
        (Button) dialogLayout.findViewById(R.id.delete_note_dialog_cancel_button);
    cancelDeleteButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "Delete dialog cancel button clicked");
            deleteDialog.dismiss();
          }
        });
  }
Example #19
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_showdialog);

    Button btn = (Button) findViewById(R.id.call);
    btn.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(SampleDialog);
          }
        });
    Button btn2 = (Button) findViewById(R.id.call2);
    btn2.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            showDialog(QuestionDialog);
          }
        });
  }
Example #20
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onCreate(savedInstanceState);
   setContentView(R.layout.snap);
   initialcam();
   // fixing for initialising an initial value for bmp via inputstream
   InputStream i = getResources().openRawResource(R.drawable.ic_launcher);
   bmp = BitmapFactory.decodeStream(i);
   ib.setOnClickListener(this);
   bton.setOnClickListener(this);
 }
 /**
  * 控制表情区和软键盘的显示
  *
  * @param isShowKeyboard
  * @param isSwitch
  */
 private void controlKeyboardOrExpr(boolean isShowKeyboard, boolean isSwitch) {
   if (isSwitch) {
     if (!isShowKeyboard) {
       mIsExprShow = true;
       mIsSoftKeyboardShow = false;
       mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
       mUiHandler.postDelayed(
           new Runnable() {
             @Override
             public void run() {
               mExpressionWidgt.setVisibility(View.VISIBLE);
             }
           },
           100);
       mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_keyboard);
     } else {
       mIsExprShow = false;
       mIsSoftKeyboardShow = true;
       mExpressionWidgt.setVisibility(View.GONE);
       mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions);
       mImm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
     }
   } else {
     if (isShowKeyboard) {
       mIsExprShow = false;
       mIsSoftKeyboardShow = true;
       mExpressionWidgt.setVisibility(View.GONE);
       mImm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
     } else {
       if (mIsSoftKeyboardShow) {
         mIsSoftKeyboardShow = false;
         mImm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
       } else {
         mIsExprShow = false;
         mExpressionWidgt.setVisibility(View.GONE);
       }
     }
     mExprBtn.setBackgroundResource(R.drawable.selector_s_chat_expressions);
   }
 }
Example #22
0
File: Main.java Project: hsbp/urc
  private void attachEventHandlers() {
    for (final Action a : Action.values()) {
      final Button b = (Button) findViewById(a.res);
      if (a.repeat) {
        b.setOnTouchListener(
            new View.OnTouchListener() {
              public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                  case MotionEvent.ACTION_DOWN:
                    sender.send(a);
                    break;
                  case MotionEvent.ACTION_UP:
                    sender.stop(a);
                    break;
                }
                return false;
              }
            });
      } else {
        b.setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                sender.send(a);
              }
            });
      }
    }
    SeekBar sb = (SeekBar) findViewById(R.id.pause);
    sb.setProgress(Sender.DEFAULT_PAUSE);
    sb.setOnSeekBarChangeListener(
        new SeekBar.OnSeekBarChangeListener() {
          public void onStopTrackingTouch(SeekBar seekBar) {}

          public void onStartTrackingTouch(SeekBar seekBar) {}

          public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            sender.setPause(progress);
          }
        });
  }
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.masstab);

    spinnerFrom = (Spinner) findViewById(R.id.SpinnerFrom);
    ArrayAdapter<CharSequence> adapter =
        ArrayAdapter.createFromResource(
            this, R.array.weights, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerFrom.setAdapter(adapter);

    spinnerTo = (Spinner) findViewById(R.id.SpinnerTo);
    spinnerTo.setAdapter(adapter);

    final Button button = (Button) findViewById(R.id.Go_Button);
    button.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            calculate();
          }
        });
  }
Example #24
0
        public void onServiceConnected(ComponentName name, IBinder service) {
          loggingService = ((GpsLoggingService.GpsLoggingBinder) service).getService();
          GpsLoggingService.SetServiceClient(GpsMainActivity.this);

          Button buttonSinglePoint = (Button) findViewById(R.id.buttonSinglePoint);

          buttonSinglePoint.setOnClickListener(GpsMainActivity.this);

          if (Session.isStarted()) {
            if (Session.isSinglePointMode()) {
              SetMainButtonEnabled(false);
            } else {
              SetMainButtonChecked(true);
              SetSinglePointButtonEnabled(false);
            }

            DisplayLocationInfo(Session.getCurrentLocationInfo());
          }

          // Form setup - toggle button, display existing location info
          ToggleButton buttonOnOff = (ToggleButton) findViewById(R.id.buttonOnOff);
          buttonOnOff.setOnCheckedChangeListener(GpsMainActivity.this);
        }
 /**
  * onClick
  *
  * <p>extracts the relai that was clicked, and asks the ipx to open then close the corresponding
  * relai
  */
 @Override
 public void onClick(View view) {
   Ipx800Control ipx = context.getIpx();
   if (view instanceof Button) {
     Button button = (Button) view;
     // Log.d(TAG, "hit the button " + button.getHint()+ "id = "+button.getId());
     try {
       int port2trigger = Integer.parseInt("" + button.getHint());
       // Log.d(TAG, "would trigger ipx out "+port2trigger);
       try {
         ipx.set(port2trigger, true);
         ipx.set(port2trigger, false);
       } catch (Exception e) {
         Toast.makeText(context, "error:" + e, Toast.LENGTH_LONG).show();
       }
     } catch (NumberFormatException e) {
       // ok, we hit a special button....
       if (button.getId() == R.id.servernameValue) context.callSettings();
       else if (button.getHint().equals("fill_me")) context.callSettings();
       // else Log.e(TAG,"unknown button code: "+button.getHint());
     }
   }
 }
  /**
   * Configure common nav parameters by specifiying resources and activity classes. Not called
   * automatically.
   */
  protected void setupNavActions(
      int buttIdLeft,
      final Class<? extends ActivityGameBase> typeLeft,
      int buttIdRight,
      final Class<? extends ActivityGameBase> typeRight) {
    Button buttLeft = (Button) findViewById(buttIdLeft);
    Button buttRight = (Button) findViewById(buttIdRight);

    buttLeft.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            Intent intent = new Intent(ActivityGameBase.this, typeLeft);
            startActivity(intent);
          }
        });

    buttRight.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            Intent intent = new Intent(ActivityGameBase.this, typeRight);
            startActivity(intent);
          }
        });
  }
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.terciaria);

    Intent i = getIntent();
    double raizPotencia = i.getDoubleExtra("raizPotencia", 0.00);
    btnVoltar = (Button) findViewById(R.id.btnVoltar);
    btnVoltar.setOnClickListener(this);

    double raiz = Math.sqrt(raizPotencia);
    double potencia = Math.pow(raizPotencia, 2);
    TextView txtRaiz = (TextView) findViewById(R.id.resRaiz);
    txtRaiz.setText(String.valueOf(raiz));
    //
    TextView txtPotencia = (TextView) findViewById(R.id.resPotencia);
    txtPotencia.setText(String.valueOf(potencia));
  }
 private void updateUI(boolean enabled) {
   if (useOverlay.m_zoom >= 17) {
     zoomInButton.setEnabled(false);
     zoomOutButton.setEnabled(true & enabled);
   } else if (useOverlay.m_zoom <= 3) {
     zoomInButton.setEnabled(true & enabled);
     zoomOutButton.setEnabled(false);
   } else {
     zoomInButton.setEnabled(enabled);
     zoomOutButton.setEnabled(enabled);
   }
 }
Example #29
0
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.settings);
   this.setTitle(R.string.setting);
   sp = PreferenceManager.getDefaultSharedPreferences(this);
   edit = sp.edit();
   Button widgettheme = (Button) findViewById(R.id.widgettheme);
   Button settime = (Button) findViewById(R.id.settime);
   Button save = (Button) findViewById(R.id.set_save);
   nc = (CheckBox) findViewById(R.id.nightcheck);
   rs = (CheckBox) findViewById(R.id.ringswitch);
   widgettheme.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           AlertDialog.Builder ad =
               new AlertDialog.Builder(Settings.this)
                   .setTitle("选择颜色?")
                   .setItems(
                       color,
                       new DialogInterface.OnClickListener() {
                         @Override
                         public void onClick(DialogInterface p1, int p2) {
                           edit.putInt("widgetTextColor", colori[p2]);
                           edit.commit();
                         }
                       });
           ad.show();
         }
       });
   settime.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View Button) {
           Intent set = new Intent(Settings.this, Settime.class);
           startActivity(set);
           return;
         }
       });
   save.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View Button) {
           save();
           return;
         }
       });
   nc.setChecked(sp.getBoolean("nightmode", false));
   if (sp.getBoolean("timewrong", false) == true) {
     rs.setChecked(false);
     rs.setClickable(false);
   }
 }
  public void startTranscode() {

    try {
      transcode();

    } catch (Exception e) {

      buttonStart.setEnabled(false);

      String message = (e.getMessage() != null) ? e.getMessage() : e.toString();

      showMessageBox(
          message,
          new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {}
          });
    }
  }