@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);
 }
Ejemplo n.º 2
0
 public void mOnClick(View v) {
   switch (v.getId()) {
     case R.id.btncopy:
       copyIntent();
       break;
     case R.id.btnpaste:
       pasteIntent();
       break;
   }
 }
Ejemplo n.º 3
0
 @Override
 public void onClick(View v) {
   // TODO Auto-generated method stub
   Intent intent;
   String parentPN; // 蹂댄샇���꾪솕踰덊샇
   /** 媛�踰꾪듉蹂꾨줈 �댁빞���쇱쓣 梨꾩썙�k뒗�� */
   switch (v.getId()) {
     case R.id.mystatbtn:
       intent = new Intent(Menus.this, Mystat.class);
       startActivity(intent);
       break;
     case R.id.noticebtn:
       intent = new Intent(Menus.this, Notice.class);
       startActivity(intent);
       break;
     case R.id.requestbtn:
       intent = new Intent(Menus.this, RequestTalk.class);
       startActivity(intent);
       break;
     case R.id.hospitalinfobtn:
       intent = new Intent(Menus.this, Hospitalinfo.class);
       startActivity(intent);
       break;
     case R.id.qrreadbtn:
       intent = new Intent(Menus.this, QRread.class);
       startActivity(intent);
       break;
     case R.id.parentcallbtn:
       parentPN = "01193699621"; // 蹂댄샇���꾪솕踰덊샇 DB�먯꽌 媛�졇��빞 ��
       intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + parentPN));
       startActivity(intent);
       break;
     case R.id.emergencybtn:
       // 蹂묒썝��湲닿툒肄�
       ((Button) findViewById(R.id.emergencybtn)).setBackgroundColor(Color.GREEN);
       ((Button) findViewById(R.id.emergencybtn)).setText("�좉퀬 �꾨즺");
       break;
   }
 }
Ejemplo n.º 4
0
  @Override
  public void onClick(View v) {
    TextView txtManageLabel, txtBrowseLabel, txtRefreshLabel, txtSearchLabel;
    txtManageLabel = (TextView) findViewById(R.id.txt_manage_label);
    txtBrowseLabel = (TextView) findViewById(R.id.txt_browse_label);
    txtRefreshLabel = (TextView) findViewById(R.id.txt_refresh_label);
    txtSearchLabel = (TextView) findViewById(R.id.txt_search_label);
    txtSearch.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(CharSequence s, int start, int before, int count) {
            new AsyncTask<String, Void, ArrayList<RssItem>>() {
              @Override
              protected ArrayList<RssItem> doInBackground(String... params) {
                return dbQuery.searchRssItem(params[0]);
              }

              @Override
              protected void onPostExecute(ArrayList<RssItem> result) {
                rssList.clear();
                rssList.addAll(result);
                rssAdapter.config().notifyDataSetChanged();
              }
            }.execute(s.toString());
          }

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

          @Override
          public void afterTextChanged(Editable s) {}
        });
    txtSearch.setOnKeyListener(
        new OnKeyListener() {
          @Override
          public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) return true;
            return false;
          }
        });
    switch (v.getId()) {
      case R.id.btn_manage:
        startActivityForResult(
            new Intent(RssReaderActivity.this, RssManageActivity.class), REQ_RSS_MANAGE);
        break;

      case R.id.btn_browse:
        rssProvider = dbQuery.getRssProviderList(null);
        int length = rssProvider.getProviderNames().length;
        if (length == 0) break;

        String[] providers = new String[length + 1];
        providers[0] = "All";
        for (int i = 0; i < length; i++) providers[i + 1] = rssProvider.getProviderNames()[i];
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder
            .setTitle(R.string.rss_choose_provider)
            .setItems(
                providers,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int item) {
                    if (item == 0) {
                      loadData(null, true, false, false);
                      return;
                    }
                    loadData(rssProvider.getProviderNames()[item - 1], false, false, false);
                    curProvider = item - 1;
                    updateListView();
                  }
                });
        builder.create().show();
        break;

      case R.id.btn_refresh:
        if (curProvider == -1) loadData(null, true, true, true);
        else
          loadData(
              dbQuery.getRssProviderList(null).getProviderNames()[curProvider], false, true, true);
        break;

      case R.id.btn_search:
        if (txtSearchLabel.getText().toString().equals(getString(R.string.btn_search_text))) {
          btnManage.setVisibility(View.GONE);
          txtManageLabel.setVisibility(View.GONE);
          btnBrowse.setVisibility(View.GONE);
          txtBrowseLabel.setVisibility(View.GONE);
          btnRefresh.setVisibility(View.GONE);
          txtRefreshLabel.setVisibility(View.GONE);
          btnSearch.setBackgroundResource(R.drawable.btn_done_background);
          txtSearchLabel.setText(R.string.btn_done_text);
          txtSearch.setVisibility(View.VISIBLE);
          txtSearch.requestFocus();
        } else {
          btnManage.setVisibility(View.VISIBLE);
          txtManageLabel.setVisibility(View.VISIBLE);
          btnBrowse.setVisibility(View.VISIBLE);
          txtBrowseLabel.setVisibility(View.VISIBLE);
          btnRefresh.setVisibility(View.VISIBLE);
          txtRefreshLabel.setVisibility(View.VISIBLE);
          btnSearch.setBackgroundResource(R.drawable.btn_search_background);
          txtSearchLabel.setText(R.string.btn_search_text);
          txtSearch.setVisibility(View.GONE);
          txtSearch.setText("");
          loadData(null, true, false, false);
        }
        break;
      default:
        break;
    }
  }
Ejemplo n.º 5
0
        public void onClick(View v) {
          ContentResolver cr = getContentResolver();
          switch (v.getId()) {
              // 전부 읽기
            case R.id.readall:
              Cursor cursor = cr.query(Uri.parse(WORDURI), null, null, null, null);

              String Result = "";
              while (cursor.moveToNext()) {
                String eng = cursor.getString(0);
                String han = cursor.getString(1);
                Result += (eng + " = " + han + "\n");
              }

              if (Result.length() == 0) {
                mText.setText("Empyt Set");
              } else {
                mText.setText(Result);
              }
              cursor.close();
              break;
              // 하나만 읽기
            case R.id.readone:
              Cursor cursor2 = cr.query(Uri.parse(WORDURI + "/boy"), null, null, null, null);

              String Result2 = "";
              if (cursor2.moveToFirst()) {
                String eng = cursor2.getString(0);
                String han = cursor2.getString(1);
                Result2 += (eng + " = " + han + "\n");
              }

              if (Result2.length() == 0) {
                mText.setText("Empyt Set");
              } else {
                mText.setText(Result2);
              }
              cursor2.close();
              break;
              // 삽입
            case R.id.insert:
              ContentValues row = new ContentValues();
              row.put("eng", "school");
              row.put("han", "학교");

              cr.insert(Uri.parse(WORDURI), row);
              mText.setText("Insert Success");
              break;
              // 삭제
            case R.id.delete:
              cr.delete(Uri.parse(WORDURI), null, null);
              mText.setText("Delete Success");
              break;
              // 수정
            case R.id.update:
              ContentValues row2 = new ContentValues();
              row2.put("han", "핵교");
              cr.update(Uri.parse(WORDURI + "/school"), row2, null, null);
              mText.setText("Update Success");
              break;
          }
        }
Ejemplo n.º 6
0
 @Override
 public void onClick(View view) {
   if (view.getId() == R.id.draw_btn) {
     if (!drawView.getErase()) {
       final Dialog brushDialog = new Dialog(this);
       brushDialog.setTitle("Brush size:");
       brushDialog.setContentView(R.layout.brush_chooser);
       ImageButton smallBtn = (ImageButton) brushDialog.findViewById(R.id.small_brush);
       smallBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(smallBrush);
               drawView.setLastBrushSize(smallBrush);
               brushDialog.dismiss();
             }
           });
       ImageButton mediumBtn = (ImageButton) brushDialog.findViewById(R.id.medium_brush);
       mediumBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(mediumBrush);
               drawView.setLastBrushSize(mediumBrush);
               brushDialog.dismiss();
             }
           });
       ImageButton largeBtn = (ImageButton) brushDialog.findViewById(R.id.large_brush);
       largeBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(largeBrush);
               drawView.setLastBrushSize(largeBrush);
               brushDialog.dismiss();
             }
           });
       brushDialog.show();
     }
     drawView.setErase(false);
   } else if (view.getId() == R.id.erase_btn) {
     if (drawView.getErase()) {
       final Dialog brushDialog = new Dialog(this);
       brushDialog.setTitle("Eraser size:");
       brushDialog.setContentView(R.layout.brush_chooser);
       ImageButton smallBtn = (ImageButton) brushDialog.findViewById(R.id.small_brush);
       smallBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(smallBrush);
               brushDialog.dismiss();
             }
           });
       ImageButton mediumBtn = (ImageButton) brushDialog.findViewById(R.id.medium_brush);
       mediumBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(mediumBrush);
               brushDialog.dismiss();
             }
           });
       ImageButton largeBtn = (ImageButton) brushDialog.findViewById(R.id.large_brush);
       largeBtn.setOnClickListener(
           new OnClickListener() {
             @Override
             public void onClick(View v) {
               drawView.setBrushSize(largeBrush);
               brushDialog.dismiss();
             }
           });
       brushDialog.show();
     }
     drawView.setErase(true);
   } else if (view.getId() == R.id.new_btn) {
     AlertDialog.Builder newDialog = new AlertDialog.Builder(this);
     newDialog.setTitle("New equation");
     newDialog.setMessage("Start new equation?");
     newDialog.setPositiveButton(
         "Yes",
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
             drawView.startNew();
             dialog.dismiss();
           }
         });
     newDialog.setNegativeButton(
         "Cancel",
         new DialogInterface.OnClickListener() {
           public void onClick(DialogInterface dialog, int which) {
             dialog.cancel();
           }
         });
     newDialog.show();
   } else if (view.getId() == R.id.equals_btn) {
     // save drawing
   }
 }
Ejemplo n.º 7
0
  public void onClickPlay(View v) {
    if (vencedor) {
      return;
    }
    Drawable background;

    switch (v.getId()) {
      case R.id.mainView1:
        if (matriz[0][0] != 0) {
          return;
        }
        matriz[0][0] = player;
        break;
      case R.id.mainView2:
        if (matriz[0][1] != 0) {
          return;
        }
        matriz[0][1] = player;
        break;
      case R.id.mainView3:
        if (matriz[0][2] != 0) {
          return;
        }
        matriz[0][2] = player;
        break;
      case R.id.mainView4:
        if (matriz[1][0] != 0) {
          return;
        }
        matriz[1][0] = player;
        break;
      case R.id.mainView5:
        if (matriz[1][1] != 0) {
          return;
        }
        matriz[1][1] = player;
        break;
      case R.id.mainView6:
        if (matriz[1][2] != 0) {
          return;
        }
        matriz[1][2] = player;
        break;
      case R.id.mainView7:
        if (matriz[2][0] != 0) {
          return;
        }
        matriz[2][0] = player;
        break;
      case R.id.mainView8:
        if (matriz[2][1] != 0) {
          return;
        }
        matriz[2][1] = player;
        break;
      case R.id.mainView9:
        if (matriz[2][2] != 0) {
          return;
        }
        matriz[2][2] = player;
        break;
    }

    if (player == 1) {
      background = getResources().getDrawable(R.drawable.red);
    } else {
      background = getResources().getDrawable(R.drawable.blue);
    }

    if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
      v.setBackgroundDrawable(background);
    } else {
      v.setBackground(background);
    }
    verificaCampeao();

    if (player == 2) {
      tv.setText("Jogador 1");
      if (vencedor) {
        tv1.setText("Vencedor: Jogador 2");
      }
    } else {
      tv.setText("Jogador 2");
      if (vencedor) {
        tv1.setText("Vencedor: Jogador 1");
      }
    }
    player = player == 1 ? 2 : 1;
  }