protected void onLayout(boolean paramBoolean, int paramInt1, int paramInt2, int paramInt3, int paramInt4)
 {
   int i2 = 1;
   int i3 = 0;
   super.onLayout(paramBoolean, paramInt1, paramInt2, paramInt3, paramInt4);
   if ((l) && (e != null))
   {
     if ((!cn.J(e)) || (e.getVisibility() != 0)) {
       break label308;
     }
     paramBoolean = true;
     m = paramBoolean;
     if (m) {
       if ((d == null) || (d == this)) {
         break label417;
       }
     }
   }
   label154:
   label171:
   label308:
   label319:
   label328:
   label417:
   for (int i1 = d.getLayoutParams()).bottomMargin;; i1 = 0)
   {
     dh.b(this, e, j);
     k.b(j.left, paramInt4 - j.height() - i1, j.right, paramInt4 - i1);
     Object localObject;
     int i4;
     int i5;
     if (cn.h(this) == 1)
     {
       localObject = k;
       if (i2 == 0) {
         break label319;
       }
       i1 = h;
       i4 = j.bottom;
       i5 = g;
       if (i2 == 0) {
         break label328;
       }
     }
     for (i2 = f;; i2 = h)
     {
       ((n)localObject).a(i1, i4 + i5, paramInt3 - paramInt1 - i2, paramInt4 - paramInt2 - i);
       k.h();
       paramInt2 = getChildCount();
       paramInt1 = i3;
       while (paramInt1 < paramInt2)
       {
         localObject = getChildAt(paramInt1);
         if ((u != null) && (!cn.z((View)localObject)))
         {
           paramInt3 = u.b();
           if (((View)localObject).getTop() < paramInt3) {
             cn.e((View)localObject, paramInt3);
           }
         }
         d((View)localObject).a();
         paramInt1 += 1;
       }
       paramBoolean = false;
       break;
       i2 = 0;
       break label154;
       i1 = f;
       break label171;
     }
     if (c != null)
     {
       if ((l) && (TextUtils.isEmpty(k.i()))) {
         k.a(c.getTitle());
       }
       if ((d == null) || (d == this)) {
         setMinimumHeight(c(c));
       }
     }
     else
     {
       return;
     }
     setMinimumHeight(c(d));
     return;
   }
 }
  public ToolbarWidgetWrapper(
      Toolbar toolbar,
      boolean style,
      int defaultNavigationContentDescription,
      int defaultNavigationIcon) {
    mToolbar = toolbar;
    mTitle = toolbar.getTitle();
    mSubtitle = toolbar.getSubtitle();
    mTitleSet = mTitle != null;
    mNavIcon = toolbar.getNavigationIcon();

    if (style) {
      final TintTypedArray a =
          TintTypedArray.obtainStyledAttributes(
              toolbar.getContext(), null, R.styleable.ActionBar, R.attr.actionBarStyle, 0);

      final CharSequence title = a.getText(R.styleable.ActionBar_title);
      if (!TextUtils.isEmpty(title)) {
        setTitle(title);
      }

      final CharSequence subtitle = a.getText(R.styleable.ActionBar_subtitle);
      if (!TextUtils.isEmpty(subtitle)) {
        setSubtitle(subtitle);
      }

      final Drawable logo = a.getDrawable(R.styleable.ActionBar_logo);
      if (logo != null) {
        setLogo(logo);
      }

      final Drawable icon = a.getDrawable(R.styleable.ActionBar_icon);
      if (mNavIcon == null && icon != null) {
        setIcon(icon);
      }

      final Drawable navIcon = a.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
      if (navIcon != null) {
        setNavigationIcon(navIcon);
      }

      setDisplayOptions(a.getInt(R.styleable.ActionBar_displayOptions, 0));

      final int customNavId = a.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
      if (customNavId != 0) {
        setCustomView(
            LayoutInflater.from(mToolbar.getContext()).inflate(customNavId, mToolbar, false));
        setDisplayOptions(mDisplayOpts | ActionBar.DISPLAY_SHOW_CUSTOM);
      }

      final int height = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
      if (height > 0) {
        final ViewGroup.LayoutParams lp = mToolbar.getLayoutParams();
        lp.height = height;
        mToolbar.setLayoutParams(lp);
      }

      final int contentInsetStart =
          a.getDimensionPixelOffset(R.styleable.ActionBar_contentInsetStart, -1);
      final int contentInsetEnd =
          a.getDimensionPixelOffset(R.styleable.ActionBar_contentInsetEnd, -1);
      if (contentInsetStart >= 0 || contentInsetEnd >= 0) {
        mToolbar.setContentInsetsRelative(
            Math.max(contentInsetStart, 0), Math.max(contentInsetEnd, 0));
      }

      final int titleTextStyle = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
      if (titleTextStyle != 0) {
        mToolbar.setTitleTextAppearance(mToolbar.getContext(), titleTextStyle);
      }

      final int subtitleTextStyle = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
      if (subtitleTextStyle != 0) {
        mToolbar.setSubtitleTextAppearance(mToolbar.getContext(), subtitleTextStyle);
      }

      final int popupTheme = a.getResourceId(R.styleable.ActionBar_popupTheme, 0);
      if (popupTheme != 0) {
        mToolbar.setPopupTheme(popupTheme);
      }

      a.recycle();
      // Keep the TintManager in case we need it later
      mTintManager = a.getTintManager();
    } else {
      mDisplayOpts = detectDisplayOptions();
      // Create a TintManager in case we need it later
      mTintManager = new TintManager(toolbar.getContext());
    }

    setDefaultNavigationContentDescription(defaultNavigationContentDescription);
    mHomeDescription = mToolbar.getNavigationContentDescription();

    setDefaultNavigationIcon(mTintManager.getDrawable(defaultNavigationIcon));

    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          final ActionMenuItem mNavItem =
              new ActionMenuItem(mToolbar.getContext(), 0, android.R.id.home, 0, 0, mTitle);

          @Override
          public void onClick(View v) {
            if (mWindowCallback != null && mMenuPrepared) {
              mWindowCallback.onMenuItemSelected(Window.FEATURE_OPTIONS_PANEL, mNavItem);
            }
          }
        });
  }
Exemplo n.º 3
0
  public void onCreate(Bundle savedInstanceState) {
    disableSwipeBackLayout();
    super.onCreate(savedInstanceState);
    applyColorTheme();
    setContentView(R.layout.activity_sendmessage);

    final Toolbar b = (Toolbar) findViewById(R.id.toolbar);
    final String name;
    reply = getIntent() != null && getIntent().hasExtra(EXTRA_REPLY);
    subject = (EditText) findViewById(R.id.subject);
    to = (EditText) findViewById(R.id.to);
    body = (EditText) findViewById(R.id.body);
    View oldMSG = findViewById(R.id.oldMSG);

    if (getIntent() != null && getIntent().hasExtra(EXTRA_NAME)) {
      name = getIntent().getExtras().getString(EXTRA_NAME, "");
      to.setText(name);
      to.setInputType(InputType.TYPE_NULL);

      if (reply) {
        b.setTitle(getString(R.string.mail_reply_to, name));
        previousMessage = DataShare.sharedMessage;
        subject.setText(getString(R.string.mail_re, previousMessage.getSubject()));
        subject.setInputType(InputType.TYPE_NULL);

        // Disable if replying to another user, as they are already set
        to.setEnabled(false);
        subject.setEnabled(false);

        body.requestFocus();

        oldMSG.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                AlertDialogWrapper.Builder b = new AlertDialogWrapper.Builder(Sendmessage.this);
                b.setTitle(getString(R.string.mail_author_wrote, name));
                b.setMessage(previousMessage.getBody());
                b.create().show();
              }
            });
      } else {
        b.setTitle(getString(R.string.mail_send_to, name));
        oldMSG.setVisibility(View.GONE);
      }
    } else {
      name = "";
      oldMSG.setVisibility(View.GONE);
      b.setTitle(R.string.mail_send);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = this.getWindow();
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    }
    setupUserAppBar(R.id.toolbar, null, true, name);
    setRecentBar(b.getTitle().toString(), Palette.getDefaultColor());

    findViewById(R.id.send)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                bodytext = body.getText().toString();
                totext = to.getText().toString();
                subjecttext = subject.getText().toString();

                new AsyncDo().execute();
              }
            });
    DoEditorActions.doActions(
        ((EditText) findViewById(R.id.body)),
        findViewById(R.id.area),
        getSupportFragmentManager(),
        Sendmessage.this,
        previousMessage == null ? null : previousMessage.getBody());
  }
 @Override
 public CharSequence getTitle() {
   return mToolbar.getTitle();
 }