Esempio n. 1
0
  protected void applyTheme(int theme) {
    Resources res = getResources();

    mRootView.setBackgroundColor(
        res.getColor(MODE_NIGHT == theme ? R.color.background_night : R.color.background));

    if (!mHideTitle) {
      final RelativeLayout titleView = (RelativeLayout) findViewById(R.id.title_bar);
      final TextView titleText = (TextView) findViewById(R.id.title_text);
      final View divider = findViewById(R.id.split_h);
      final ImageView backBtn = (ImageView) findViewById(R.id.ic_arrow);

      final View leftView = findViewById(R.id.back_view);

      if (MODE_NIGHT == theme) {
        titleView.setBackgroundColor(0xFF1C1C1C);
        titleText.setTextColor(0xFF666666);
        divider.setBackgroundColor(0xFF303030);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back_night);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg_night);
      } else {
        titleView.setBackgroundColor(res.getColor(R.color.action_bar_color));
        titleText.setTextColor(res.getColor(R.color.white));
        divider.setBackgroundColor(0xFFCACACA);
        if (null != backBtn) {
          backBtn.setImageResource(R.drawable.ic_back);
        }
        if (null != leftView) leftView.setBackgroundResource(R.drawable.feedback_bkg);
      }
    }
  }
Esempio n. 2
0
  protected void setRightButtonText(String text) {
    RelativeLayout rightView = (RelativeLayout) findViewById(R.id.right_view);
    rightView.removeAllViews();

    int padding = dp2px(6);
    RelativeLayout.LayoutParams lp =
        new RelativeLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    lp.setMargins(0, 0, dp2px(8), 0);
    TextView tv = new TextView(this);
    tv.setText(text);
    tv.setTextColor(0xFF666666);
    tv.setTextSize(16.f);
    tv.setLayoutParams(lp);
    tv.setBackgroundResource(R.drawable.btn_gray);
    tv.setPadding(2 * padding, padding, 2 * padding, padding);
    tv.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onRightButtonClicked(v);
          }
        });

    rightView.addView(tv);
    rightView.setVisibility(View.VISIBLE);
  }
Esempio n. 3
0
 @Override
 public void setTitle(CharSequence title) {
   final TextView textView = (TextView) findViewById(R.id.title_text);
   textView.setText(title);
   textView.setVisibility(View.VISIBLE);
 }