@Override
    public void onItemSelected(AdapterView<?> adapter, View vview, int position, long id) {
      // 获取选择的项的值
      if (curStage != position) {
        for (int i = 0; i < stageList.length; i++) {
          for (int j = 0; j < stageList[i].nodeList.length; j++) {
            for (int k = 0; k < stageList[i].nodeList[j].deviceList.length; k++) {
              int curId = i * 1000 + j * 100 + k;
              Button curButton = (Button) view.findViewById(curId);
              if (i == position) curButton.setVisibility(View.VISIBLE);
              else curButton.setVisibility(View.GONE);
            }
          }
        }
        Button curButton = (Button) view.findViewById(curSelect);
        curButton.setBackgroundResource(R.drawable.focus_false);
        curStage = position;
        frameLayout = (FrameLayout) view.findViewById(R.id.container);

        if (curStage == 0) {
          frameLayout.setBackgroundResource(R.drawable.map911);
          Button firstButton = (Button) view.findViewById(0);
          firstButton.setBackgroundResource(R.drawable.focus_true);
          ChangeButton(0);
          curSelect = 0;
        } else {
          frameLayout.setBackgroundResource(R.drawable.map631);
          Button firstButton = (Button) view.findViewById(1000);
          firstButton.setBackgroundResource(R.drawable.focus_true);
          ChangeButton(1000);
          curSelect = 1000;
        }
      }
    }
 public void handleMessage(Message msg) {
   String message = (String) msg.obj;
   pd.dismiss();
   switch (msg.what) {
     case Constant.CHANGEMOBILE_SUCCEED:
       // 隐藏软键盘
       View view = getWindow().peekDecorView();
       if (view != null) {
         InputMethodManager inputmanger =
             (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
         inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
       }
       Intent intent = getIntent();
       intent.putExtra("message", message);
       intent.putExtra("mobile", mobile);
       // TODO
       setResult(RESULT_OK, intent);
       edit.putString("mobile", mobile);
       edit.commit();
       finish();
       break;
     case Constant.CHANGEMOBILE_FAILED:
       showMsg(message, "alert", "top");
       break;
     case Constant.CHANGEMOBILE_FAILED_NULL:
       showMsg(getString(R.string.returndata_null), "alert", "top");
       break;
     case Constant.SENDSMS_SUCCEED:
       showMsg(message, "alert", "top");
       btn_cha_val.setEnabled(false);
       btn_cha_val.setBackgroundResource(R.drawable.res_blank_val);
       task =
           new TimerTask() {
             public void run() {
               handler.sendEmptyMessage(Constant.VALIDATECODE_UI);
             }
           };
       timer.schedule(task, 0, 1000);
       break;
     case Constant.SENDSMS_FAILED:
       showMsg(message, "alert", "top");
       break;
     case Constant.SENDSMS_FAILED_NULL:
       showMsg(getString(R.string.returndata_null), "alert", "top");
       break;
     case Constant.VALIDATECODE_UI:
       time--;
       btn_cha_val.setText(time + getResources().getString(R.string.regetvalidateno));
       if (time == 0) {
         task.cancel();
         task = null;
         timer.cancel();
         timer = null;
         btn_cha_val.setText("");
         btn_cha_val.setEnabled(true);
         btn_cha_val.setBackgroundResource(R.drawable.btn_res_val);
       }
       break;
   }
 }
Beispiel #3
0
  public void initButton() {
    zu3Button = (Button) findViewById(R.id.buy_zixuan_button_zu3);
    zu6Button = (Button) findViewById(R.id.buy_zixuan_button_zu6);
    zu3Button.setText("组三");
    zu6Button.setText("组六");
    zu3Button.setBackgroundResource(R.drawable.zu_button_b);
    zu6Button.setBackgroundResource(R.drawable.zu_button);
    zu3Button.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            zu3Button.setBackgroundResource(R.drawable.zu_button_b);
            zu6Button.setBackgroundResource(R.drawable.zu_button);
            topLinearTwo.setVisibility(LinearLayout.VISIBLE);
            create_ZU3();
          }
        });

    zu6Button.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            zu3Button.setBackgroundResource(R.drawable.zu_button);
            zu6Button.setBackgroundResource(R.drawable.zu_button_b);
            topLinearTwo.setVisibility(LinearLayout.GONE);
            create_ZU6();
          }
        });
  }
 public void checkAnswer(String str) {
   Button nextButton = (Button) findViewById(R.id.viewer_next_button);
   Button showMeButton = (Button) findViewById(R.id.viewer_answer_button);
   if (isCorrectAnswer(str)) {
     showMeButton.setBackgroundResource(R.drawable.green_button);
     nextButton.setBackgroundResource(R.drawable.green_button);
     nextButton.setText("Continue");
     TextView tv = (TextView) findViewById(R.id.viewer_photoName);
     tv.setText(AssetManagement.getPhotoName(assetPaths[assetIndex]));
     isCorrect = true;
     if (firstCorrect) {
       Toast.makeText(ViewerActivity.this, "Correct!", Toast.LENGTH_SHORT).show();
       firstCorrect = false;
     }
     Log.d(TAG, "Correct");
   } else {
     showMeButton.setBackgroundResource(R.drawable.red_button);
     nextButton.setBackgroundResource(R.drawable.red_button);
     nextButton.setText("Skip");
     TextView tv = (TextView) findViewById(R.id.viewer_photoName);
     tv.setText("");
     isCorrect = false;
     if (firstWrong) {
       Toast.makeText(ViewerActivity.this, "Touch photo for another try!", Toast.LENGTH_SHORT)
           .show();
       firstWrong = false;
     }
   }
   LinearLayout ll = (LinearLayout) findViewById(R.id.viewer_controlsFrame);
   ll.setVisibility(View.VISIBLE);
   Log.d(TAG, "Wrong");
 }
  @Override
  public void onClick(View v) {

    switch (v.getId()) {
      case R.id.common_title_btn_back:
        {
          comeBackHome();
        }
        break;
      case R.id.common_title_btn_right:
        if (limitbuyAdapter != null) {
          int tag = (Integer) common_title_btn_right.getTag();
          if (1 == tag) {
            limitbuyAdapter.setBigPictureOrLittlePicture(0);
            common_title_btn_right.setBackgroundResource(R.drawable.bg_hot_prom_pager);
            common_title_btn_right.setTag(0);
          } else if (0 == tag) {
            limitbuyAdapter.setBigPictureOrLittlePicture(1);
            common_title_btn_right.setBackgroundResource(R.drawable.bg_topbar_switch_mini_false);
            common_title_btn_right.setTag(1);
          }
        }
        break;
    }
  }
 public void setUploadedBackGround(boolean uploaded) {
   if (uploaded) {
     removeBotton.setBackgroundResource(R.drawable.upload_good);
   } else {
     removeBotton.setBackgroundResource(R.drawable.upload_bad);
   }
 }
Beispiel #7
0
 public void showfenxdialog() {
   LayoutInflater inflate =
       (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
   View view = inflate.inflate(R.layout.touzhu_succe, null);
   final AlertDialog dialog = new AlertDialog.Builder(getParent()).create();
   ImageView image = (ImageView) view.findViewById(R.id.touzhu_succe_img);
   Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure);
   Button share = (Button) view.findViewById(R.id.touzhu_succe_button_share);
   image.setImageResource(R.drawable.succee);
   ok.setBackgroundResource(R.drawable.loginselecter);
   share.setBackgroundResource(R.drawable.loginselecter);
   ok.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           // TODO Auto-generated method stub
           dialog.cancel();
           ZiXuanTouZhu.this.finish();
         }
       });
   share.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           // TODO Auto-generated method stub
           dialog.cancel();
           ZiXuanTouZhu.this.finish();
           Intent intent = new Intent(Intent.ACTION_SEND);
           intent.setType("text/plain");
           intent.putExtra(Intent.EXTRA_SUBJECT, "分享给朋友");
           intent.putExtra(Intent.EXTRA_TEXT, "我刚刚使用如意彩手机客户端购买了一张彩票:" + "快来参与吧!官网www.ruyicai.com");
           startActivity(Intent.createChooser(intent, "请选择分享方式"));
         }
       });
   dialog.show();
   dialog.getWindow().setContentView(view);
 }
  public void showfenxdialog(String messagestr) {
    LayoutInflater inflate =
        (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflate.inflate(R.layout.touzhu_succe, null);
    final AlertDialog dialog = new AlertDialog.Builder(this).create();
    ImageView image = (ImageView) view.findViewById(R.id.touzhu_succe_img);
    Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure);
    Button share = (Button) view.findViewById(R.id.touzhu_succe_button_share);
    TextView message = (TextView) view.findViewById(R.id.touzhu_succe_text);
    message.setText(messagestr);
    image.setImageResource(R.drawable.succee);
    ok.setBackgroundResource(R.drawable.loginselecter);
    share.setBackgroundResource(R.drawable.loginselecter);
    ok.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            dialog.cancel();
            JoinStartActivity.this.finish();
          }
        });
    share.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            // TODO Auto-generated method stub
            dialog.cancel();
            Intent intent = new Intent(JoinStartActivity.this, JoinStarShare.class);
            JoinStartActivity.this.startActivity(intent);
            JoinStartActivity.this.finish();
          }
        });

    dialog.show();
    dialog.getWindow().setContentView(view);
  }
 /** 最简单的dialogure设置圆角背景 在没有title的时候使用 */
 public void setDialogRoundBg() {
   setMessage(null, 16);
   mContentView.setBackgroundResource(R.drawable.common_radius_top_white_background);
   mOkBtn.setBackgroundResource(R.drawable.common_radius_bottom_right_white_background);
   mCancelBtn.setBackgroundResource(R.drawable.common_radius_bottom_lift_white_background);
   mButtonView.setBackgroundResource(R.drawable.common_radius_bottom_white_background);
 }
Beispiel #10
0
 private void resetAnswerButtonBackground(int blueButton) {
   //
   buttonAnswer1.setBackgroundResource(blueButton);
   buttonAnswer2.setBackgroundResource(blueButton);
   buttonAnswer3.setBackgroundResource(blueButton);
   buttonAnswer4.setBackgroundResource(blueButton);
 }
  private void updateBtnColors(boolean b) {
    DataSource dataSource = DataService.getDataSource();
    if (!(dataSource instanceof TableDishRelations)) return;
    LinearLayout btnsParent = (LinearLayout) findViewById(R.id.order_btns);
    for (int i = btnsParent.getChildCount(); i > 0; i--) {
      Button btn = (Button) btnsParent.getChildAt(i - 1);
      int tableNr = Integer.parseInt(btn.getText().toString().replace("Bord ", ""));
      if (tableOrders.getDishesFromTable(tableNr - 1).size() > 0) {
        List<TableHasDish> tbl2 = tableOrders.getDishesFromTable(tableNr - 1);
        List<TableHasDish> tbl1 = tableOrdersLocal.getDishesFromTable(tableNr - 1);

        boolean isEqual = tbl1.size() == tbl2.size();
        if (isEqual) {
          for (TableHasDish hd : tbl1) {
            for (TableHasDish hd2 : tbl2) {
              if (hd.getDish().id != hd2.getDish().id) isEqual = false;
            }
          }
        }
        // om tableOrder == dataSource => lagar mat => orange
        if (isEqual) btn.setBackgroundResource(R.drawable.orange_button);
        // annars => kund äter => grön
        else btn.setBackgroundResource(R.drawable.green_button);
      } else btn.setBackgroundResource(R.drawable.default_button);
    }
  }
 private void toggleButtonImage() {
   if (isFlashOn) {
     B_Flashlight.setBackgroundResource(R.drawable.main_button_flashligh_switch_ont);
   } else {
     B_Flashlight.setBackgroundResource(R.drawable.main_button_flashligh_switch_off);
   }
 }
 /** 已通过审核窗口 */
 protected View successDialog() {
   start = true;
   LayoutInflater inflater = LayoutInflater.from(this);
   View successView = inflater.inflate(R.layout.get_money_state, null);
   TextView content = (TextView) successView.findViewById(R.id.get_money_state_text);
   content.setText(R.string.success_text);
   Button submit = (Button) successView.findViewById(R.id.get_money_img_submit);
   submit.setText(R.string.usercenter_withdrawAnew);
   submit.setBackgroundResource(R.drawable.join_info_btn_selecter);
   Button cancel = (Button) successView.findViewById(R.id.get_money_img_cancel);
   cancel.setBackgroundResource(R.drawable.join_info_btn_selecter);
   submit.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           //				setContentView(getMoneyDialog());
           checkDNA();
         }
       });
   cancel.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           finish();
         }
       });
   return successView;
 }
  /**
   * 显示窗口,重新加载url,重新定义窗口大小,设置背景透明度
   *
   * @param position 点击列表位置
   */
  private void showPopWindow(int position) {
    try {
      Bitmap screenBitmap = ScreenShortCutUtil.getShortScreen(getActivity());
      if (screenBitmap != null) {
        FastBlur.blur(getActivity(), screenBitmap, popView);
        screenBitmap.recycle();
      }

    } catch (Exception ex) {

    }

    int baseHight = 0;
    baseHight = Math.round(baseWidth / screenWByH);
    if (mList.get(position).getIsDianZan() == 0) {
      popHotPoint.setBackgroundResource(R.mipmap.love);
    } else {
      popHotPoint.setBackgroundResource(R.mipmap.loved);
    }
    ViewGroup.LayoutParams params = popContainer.getLayoutParams();
    params.width = Math.round(baseWidth);
    params.height = baseHight;
    popContainer.setLayoutParams(params);
    ViewGroup.LayoutParams layoutParams = mWebView.getLayoutParams();
    layoutParams.width = Math.round(baseWidth);
    layoutParams.height = baseHight;
    mWebView.setLayoutParams(layoutParams);
    //        mWebView.setVisibility(View.GONE);

    mWebView.loadUrl(mList.get(position).getShowPath());

    popTitle.setText(mList.get(position).getTitle());
    popAuthor.setText(mList.get(position).getAuthor().getNickname());
    popupWindow.showAtLocation(layView, Gravity.CENTER, 0, 0);
  }
Beispiel #15
0
  @Override
  public void onPageSelected(int position) {
    initBtn();

    // showToast(position+"");

    switch (position) {
      case 0:
        btnSpring.setBackgroundResource(R.drawable.wash_btn_press);
        btnSpring.setTextColor(Color.parseColor("#28ccfc"));
        break;
      case 1:
        btnSummer.setBackgroundResource(R.drawable.wash_btn_press);
        btnSummer.setTextColor(Color.parseColor("#28ccfc"));
        break;
      case 2:
        btnAutumn.setBackgroundResource(R.drawable.wash_btn_press);
        btnAutumn.setTextColor(Color.parseColor("#28ccfc"));
        break;
      case 3:
        btnWinter.setBackgroundResource(R.drawable.wash_btn_press);
        btnWinter.setTextColor(Color.parseColor("#28ccfc"));
        break;
    }
  }
Beispiel #16
0
  private void getFileDir(String filePath) {
    items = new ArrayList<String>();
    paths = new ArrayList<String>();

    File f = new File(filePath);

    Log.i(TAG, "filePath=" + filePath + "&rootPath=" + rootPath);

    // 当前目录为根目录时
    if (filePath.equals(rootPath)) {
      Log.i(TAG, "filePath == rootPath");
      tv_showFolderName.setText(R.string.sdcard);
      btn_naviationPrevious.setEnabled(false);
      btn_naviationPrevious.setBackgroundResource(R.drawable.icon_navigation_previous_item_disable);
    } else {
      tv_showFolderName.setText(f.getName());
      btn_naviationPrevious.setEnabled(true);
      btn_naviationPrevious.setBackgroundResource(R.drawable.icon_navigation_previous_item);
    }

    File[] files = f.listFiles();

    for (int i = 0; i < files.length; i++) {
      File file = files[i];
      items.add(file.getName());
      paths.add(file.getPath());
    }

    lv_showFile.setAdapter(new UploadFileListAdapter(this, items, paths));
  }
Beispiel #17
0
 private void switchAcceptMsg() {
   if (App.PREFS.isAcceptMsg()) {
     btnMsgSwitch.setBackgroundResource(R.drawable.apply_msg_on);
   } else {
     btnMsgSwitch.setBackgroundResource(R.drawable.apply_msg_off);
   }
 }
  public void cancel(View v) {
    // settext = ''
    edtFname.setText("");
    edtLname.setText("");
    edtEmail.setText("");
    edtAge.setText("");

    // set button color = blue
    btnAge.setBackgroundResource(R.drawable.button_custom);
    btnDob.setBackgroundResource(R.drawable.button_custom);
    btnUnborn.setBackgroundResource(R.drawable.button_custom);
    btnMale.setBackgroundResource(R.drawable.maleselector);
    btnFemale.setBackgroundResource(R.drawable.femaleselector);

    btnAge.setTextColor(Color.WHITE);
    btnDob.setTextColor(Color.WHITE);
    btnUnborn.setTextColor(Color.WHITE);
    // btnMale.setTextColor(Color.WHITE);
    // btnFemale.setTextColor(Color.WHITE);

    // reset visibility
    spYear.setVisibility(View.INVISIBLE);
    spMonth.setVisibility(View.INVISIBLE);
    spDay.setVisibility(View.INVISIBLE);
    edtAge.setVisibility(View.INVISIBLE);

    Intent i = new Intent(Profile_Edit.this, Profile_view.class);
    i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    i.putExtra("EXIT", true);
    this.startActivity(i);
    // finish();

  }
Beispiel #19
0
 private void switchShake() {
   if (App.PREFS.isShakeOpen()) {
     btnShakeSwitch.setBackgroundResource(R.drawable.apply_msg_on);
   } else {
     btnShakeSwitch.setBackgroundResource(R.drawable.apply_msg_off);
   }
 }
 public void click(View view) {
   int id = view.getId();
   switch (id) {
     case R.id.btnPlay:
       synchronized (this) {
         if (isTuning) {
           isTuning = false;
           btnPlay.setBackgroundResource(R.drawable.play);
           track.pause();
         } else {
           isTuning = true;
           btnPlay.setBackgroundResource(R.drawable.pause);
           playTrack();
         }
       }
       return;
     case R.id.btnPrevious:
       setTrack(0);
       loadTrack();
       playTrack();
       return;
     case R.id.btnNext:
       setTrack(1);
       loadTrack();
       playTrack();
       return;
     default:
       return;
   }
 }
  public void showIssue(final String issue) {
    LayoutInflater inflate =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflate.inflate(R.layout.touzhu_succe, null);
    final AlertDialog dialog = new AlertDialog.Builder(context).create();
    TextView textContent = (TextView) view.findViewById(R.id.touzhu_succe_text);
    Button ok = (Button) view.findViewById(R.id.touzhu_succe_button_sure);
    Button cancel = (Button) view.findViewById(R.id.touzhu_succe_button_share);
    ok.setBackgroundResource(R.drawable.loginselecter);
    cancel.setBackgroundResource(R.drawable.loginselecter);
    ok.setText(context.getString(R.string.dialog_issue_text_ok));
    cancel.setText(context.getString(R.string.dialog_issue_text_cancel));
    textContent.setText(context.getString(R.string.dialog_issue_text_content) + issue + "期。");
    ok.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            touzhuIssue(issue);
          }
        });
    cancel.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            dialog.cancel();
            finish();
          }
        });

    dialog.show();
    dialog.getWindow().setContentView(view);
  }
Beispiel #22
0
 @Override
 public void onResume() {
   super.onResume();
   btnResume.setEnabled(GameData.savedGameExist());
   btnStart.setBackgroundResource(R.drawable.button);
   btnResume.setBackgroundResource(R.drawable.button);
   btnExit.setBackgroundResource(R.drawable.button);
 }
 private void paintResponse(Button btnVote, int responseType) {
   // Paint the button depending on the response type
   if (responseType == Response.RESPONSE_TYPE_ATTENDING) {
     btnVote.setBackgroundResource(R.drawable.button_poll_option_attending_background);
   } else {
     btnVote.setBackgroundResource(R.drawable.button_poll_option_not_attending_background);
   }
 }
 private void setupPlayPauseButton(View parent, boolean isPlaying) {
   Button button = (Button) _panelView.findViewById(R.id.button_play_or_pause);
   button.setTag(R.id.tag_play_state, isPlaying);
   if (isPlaying) {
     button.setBackgroundResource(android.R.drawable.ic_media_pause);
   } else {
     button.setBackgroundResource(android.R.drawable.ic_media_play);
   }
 }
 /*
 onResume greys out and disables point button if fixed point is disabled or makes it appear like
 other buttons to show it is enabled when fixed point is enabled
  */
 public void onResume() {
   super.onResume();
   if (GlobalVar.fixedPointEnabled == true) {
     pointButton.setActivated(true);
     pointButton.setBackgroundResource(R.drawable.buttons_calc);
   } else if (GlobalVar.fixedPointEnabled == false) {
     pointButton.setActivated(false);
     pointButton.setBackgroundResource(R.drawable.buttons_disable);
   }
 }
 public void cheakButton() {
   if ((newPassword.getText().toString().length() > 0)
       && (verifyNewPassword.getText().toString().length() > 0)) {
     uploadNewPassword.setBackgroundResource(R.drawable.login_button_color);
     uploadNewPassword.setEnabled(true);
   } else {
     uploadNewPassword.setBackgroundResource(R.drawable.login_button_nopress);
     uploadNewPassword.setEnabled(false);
   }
 }
Beispiel #27
0
 // set the speed icon based on our current speed
 private void setSpeedIcon() {
   Button speed = (Button) findViewById(R.id.speed_tab);
   if (openGLRenderer.speed == openGLRenderer.SPEED2)
     speed.setBackgroundResource(R.drawable.speed2);
   else if (openGLRenderer.speed == openGLRenderer.SPEED3)
     speed.setBackgroundResource(R.drawable.speed3);
   else if (openGLRenderer.speed == openGLRenderer.SPEED4)
     speed.setBackgroundResource(R.drawable.speed4);
   else speed.setBackgroundResource(R.drawable.speed1);
 }
Beispiel #28
0
  private void initBarButtons() {
    final LinearLayout.LayoutParams llButtonParams =
        new LinearLayout.LayoutParams(buttonWidth, buttonWidth);
    llButtonParams.setMargins(0, 0, buttonMargin, 0);

    undoButton.setBackgroundResource(R.drawable.undo_button_selector);
    undoButton.setPadding(0, 0, 0, 0);
    undoButton.setLayoutParams(llButtonParams);
    this.addView(undoButton);

    redoButton.setBackgroundResource(R.drawable.redo_button_selector);
    redoButton.setPadding(0, 0, 0, 0);
    redoButton.setLayoutParams(llButtonParams);
    this.addView(redoButton);

    // Tool radio group
    LayoutParams radioGroupParams =
        new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    radioGroupParams.setMargins(0, 0, 0, 0);

    final RadioGroup toolRadioGroup = new RadioGroup(this.getContext());
    toolRadioGroup.setOrientation(RadioGroup.HORIZONTAL);
    toolRadioGroup.setLayoutParams(radioGroupParams);
    toolRadioGroup.setPadding(0, 0, 0, 0);

    final RadioGroup.LayoutParams rgButtonParams =
        new RadioGroup.LayoutParams(buttonWidth, buttonWidth);
    rgButtonParams.setMargins(0, 0, buttonMargin, 0);

    selectButton.setButtonDrawable(R.drawable.select_button_selector);
    selectButton.setLayoutParams(rgButtonParams);
    toolRadioGroup.addView(selectButton);

    eraserButton.setButtonDrawable(R.drawable.erase_button_selector);
    eraserButton.setLayoutParams(rgButtonParams);
    toolRadioGroup.addView(eraserButton);

    for (int i = 0; i < 8; i++) {
      penButtons[i] = new PenRadioButton(this.getContext());
      penButtons[i].setLayoutParams(rgButtonParams);
      toolRadioGroup.addView(penButtons[i]);
    }

    this.addView(toolRadioGroup);

    menuButtonSpacer.setLayoutParams(
        new LinearLayout.LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f));
    this.addView(menuButtonSpacer);

    menuButton.setBackgroundResource(R.drawable.ic_action_overflow);
    menuButton.setPadding(0, 0, 0, 0);
    menuButton.setLayoutParams(llButtonParams);
    menuButton.setOnClickListener(menuButtonListener);
    this.addView(menuButton);
  }
 private void changeBindButton() {
   String emails = email_editText.getText().toString();
   String codes = code_editText.getText().toString();
   if (!TextUtils.isEmpty(emails) && codes.length() > 3) {
     bindEmail.setClickable(true);
     bindEmail.setBackgroundResource(R.drawable.border_button_orange);
   } else {
     bindEmail.setClickable(false);
     bindEmail.setBackgroundResource(R.drawable.border_button_gray);
   }
 }
  public static Button setLoginButtonStyle(BaseActivity activity, int resId) {
    Button button = (Button) activity.findViewById(resId);
    if (AppContext.getIdentityType() == 1) {
      button.setBackgroundResource(R.drawable.login_btn_bg);

    } else {
      button.setBackgroundResource(R.drawable.login_btn_bg);
    }
    button.setTextColor(activity.getResources().getColor(R.color.app_white));
    return button;
  }