public void isShowOkBt() {
   if (Bimp.tempSelectBitmap.size() > 0) {
     okButton.setText(
         Res.getString("finish")
             + "("
             + Bimp.tempSelectBitmap.size()
             + "/"
             + PublicWay.num_campaigner
             + ")");
     preview.setPressed(true);
     okButton.setPressed(true);
     preview.setClickable(true);
     okButton.setClickable(true);
     okButton.setTextColor(Color.WHITE);
     preview.setTextColor(Color.WHITE);
   } else {
     okButton.setText(
         Res.getString("finish")
             + "("
             + Bimp.tempSelectBitmap.size()
             + "/"
             + PublicWay.num_campaigner
             + ")");
     preview.setPressed(false);
     preview.setClickable(false);
     okButton.setPressed(false);
     okButton.setClickable(false);
     okButton.setTextColor(Color.parseColor("#E1E0DE"));
     preview.setTextColor(Color.parseColor("#E1E0DE"));
   }
 }
Пример #2
0
  private void initPopupWindow() {
    LayoutInflater inflater = LayoutInflater.from(this);
    View view = inflater.inflate(R.layout.square_chooser, null);
    Button newest = (Button) view.findViewById(R.id.newest);
    newest.setOnClickListener(this);
    newest.setPressed(true);
    Button close = (Button) view.findViewById(R.id.close);
    close.setOnClickListener(this);
    Button high = (Button) view.findViewById(R.id.high);
    high.setOnClickListener(this);
    pop = new PopupWindow(view, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, false);
    RelativeLayout chooser = (RelativeLayout) findViewById(R.id.chooser);
    pop.setBackgroundDrawable(new BitmapDrawable());
    pop.setOutsideTouchable(true);
    pop.setFocusable(true);
    chooser.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            int flat = 1;
            if (flat == 1) {
              choosearrow.setImageResource(R.drawable.ic_menu_trangle_up);
              pop.showAsDropDown(v);
              flat = 0;
            } else if (flat == 0) {
              choosearrow.setImageResource(R.drawable.ic_menu_trangle_down);
              pop.dismiss();
              flat = 1;
            }
          }
        });
  }
 /**
  * Callback for button click when you whack the mole.
  *
  * @param v View name
  */
 public void game_button_clicked(View v) {
   final Button b = (Button) findViewById(v.getId());
   b.setPressed(true);
   button_pressed = true;
   hide_button(b);
   ActivityHelper.vibrate(Constants.WH_VIBRATE_SHORT);
   ActivityHelper.play(R.raw.splat);
   score++;
 }
Пример #4
0
  public void pressButtonById(int nIdPressed, boolean bSwitchActivity) {
    boolean bFoundButton = false;

    // Unpress all the buttons except the one we passed in
    for (Button bt : buttons) {
      if (nIdPressed == bt.getId()) {
        bFoundButton = true;
        // bt.setBackgroundResource(R.color.activity_bar_button_selected);
        // bt.setCompoundDrawablesWithIntrinsicBounds(null, drawableTop, null, null);
        System.out.println("nIdPressed: " + nIdPressed + ", bt Id: " + bt.getText());

        if (bt.getText().equals("Haberler"))
          drawableTop = parentActivity.getResources().getDrawable(R.drawable.icon_haber_selected);
        else if (bt.getText().equals("Kurumsal"))
          drawableTop =
              parentActivity.getResources().getDrawable(R.drawable.icon_kurumsal_selected);
        else if (bt.getText().equals("Yönetim"))
          drawableTop = parentActivity.getResources().getDrawable(R.drawable.icon_yonetim_selected);
        else { // WEB TV
          drawableTop = parentActivity.getResources().getDrawable(R.drawable.icon_webtv_selected);
        }

        bt.setCompoundDrawablesWithIntrinsicBounds(null, drawableTop, null, null);
      } else {
        bt.setPressed(false);
        bt.setBackgroundResource(android.R.color.transparent);
      }
    }

    // If we asked to switch activities and the button passed in was good, do it
    if (bSwitchActivity && bFoundButton && nIdPressed != currentBtnId && parentActivity != null) {
      switch (nIdPressed) {
        case R.id.btnHaber:
          switchActivity(new Intent(parentActivity, Haberler.class));
          break;
        case R.id.btnKurumsal:
          switchActivity(new Intent(parentActivity, Kurumsal.class));
          break;
        case R.id.btnYonetim:
          switchActivity(new Intent(parentActivity, Yoneticiler.class));
          break;
        case R.id.btnWebTv:
          // switchActivity(new Intent(parentActivity, WebTv.class));
          /*
          Intent intent= new Intent();
          intent.setAction("android.intent.action.VIEW");
          Uri content_url = Uri.parse("http://www.chp.org.tr/custom-scripts/webtv.html");
          intent.setData(content_url);
          intent.setClassName("com.android.chrome","com.android.chrome.mai");
          startActivity(intent);*/

          try {
            Intent i = new Intent("android.intent.action.MAIN");
            i.setComponent(
                ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main"));
            i.addCategory("android.intent.category.LAUNCHER");
            i.setData(Uri.parse("http://www.chp.org.tr/custom-scripts/webtv.html"));
            parentActivity.startActivity(i);
          } catch (ActivityNotFoundException e) {
            // Chrome is probably not installed
          }

          /*
          Intent myIntent;
          PackageManager pm = parentActivity.getPackageManager();
          try{
              myIntent = pm.getLaunchIntentForPackage("com.mxtech.videoplayer.pro");
              myIntent.setComponent(new ComponentName("com.mxtech.videoplayer.pro", "com.mxtech.videoplayer.ActivityScreen"));
              myIntent.setDataAndType(Uri.parse("http://www.chp.org.tr/custom-scripts/webtv.html"), "application/x-mpegURL");
              myIntent.putExtra("secure_uri", true);
              //myIntent.putExtra(parentActivity.EXTRA_DECODE_MODE, (byte)2);
              if (null != myIntent)
                  parentActivity.startActivity(myIntent);
          }
          catch (ActivityNotFoundException e)
          {

              Toast.makeText(parentActivity,
                      " stream not working ",
                      Toast.LENGTH_LONG).show();
          }*/

          break;
      }
    }

    currentBtnId = bFoundButton ? nIdPressed : -1;
  }