@Override
 public void setActionBarDescription(@StringRes int contentDescRes) {
   if (contentDescRes == 0) {
     mToolbar.setNavigationContentDescription(mDefaultContentDescription);
   } else {
     mToolbar.setNavigationContentDescription(contentDescRes);
   }
 }
 private void updateHomeAccessibility() {
   if ((mDisplayOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
     if (TextUtils.isEmpty(mHomeDescription)) {
       mToolbar.setNavigationContentDescription(mDefaultNavigationContentDescription);
     } else {
       mToolbar.setNavigationContentDescription(mHomeDescription);
     }
   }
 }
  /** {@inheritDoc} from Fragment */
  @Override
  public View onCreateView(
      final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.contact_picker_fragment, container, false);
    mRecipientTextView =
        (ContactRecipientAutoCompleteView) view.findViewById(R.id.recipient_text_view);
    mRecipientTextView.setThreshold(0);
    mRecipientTextView.setDropDownAnchor(R.id.compose_contact_divider);

    mRecipientTextView.setContactChipsListener(this);
    mRecipientTextView.setDropdownChipLayouter(
        new ContactDropdownLayouter(inflater, getActivity(), this));
    mRecipientTextView.setAdapter(new ContactRecipientAdapter(getActivity(), this));
    mRecipientTextView.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(
              final CharSequence s, final int start, final int before, final int count) {}

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

          @Override
          public void afterTextChanged(final Editable s) {
            updateTextInputButtonsVisibility();
          }
        });

    final CustomHeaderPagerViewHolder[] viewHolders = {
      mFrequentContactsListViewHolder, mAllContactsListViewHolder
    };

    mCustomHeaderViewPager = (CustomHeaderViewPager) view.findViewById(R.id.contact_pager);
    mCustomHeaderViewPager.setViewHolders(viewHolders);
    mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE);
    mCustomHeaderViewPager.setBackgroundColor(
        getResources().getColor(R.color.contact_picker_background));

    // The view pager defaults to the frequent contacts page.
    mCustomHeaderViewPager.setCurrentItem(0);

    mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
    mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_light);
    mToolbar.setNavigationContentDescription(R.string.back);
    mToolbar.setNavigationOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            mHost.onBackButtonPressed();
          }
        });

    mToolbar.inflateMenu(R.menu.compose_menu);
    mToolbar.setOnMenuItemClickListener(this);

    mComposeDivider = view.findViewById(R.id.compose_contact_divider);
    mRootView = view;
    return view;
  }
Esempio n. 4
0
 protected Toolbar getActionBarToolbar() {
   if (mActionBarToolbar == null) {
     mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
     if (mActionBarToolbar != null) {
       // Depending on which version of Android you are on the Toolbar or the ActionBar may be
       // active so the a11y description is set here.
       mActionBarToolbar.setNavigationContentDescription(
           getResources().getString(R.string.navdrawer_description_a11y));
       setSupportActionBar(mActionBarToolbar);
     }
   }
   return mActionBarToolbar;
 }
Esempio n. 5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    UIUtils.tryTranslateHttpIntent(this);
    BeamUtils.tryUpdateIntentFromBeam(this);
    boolean shouldBeFloatingWindow = shouldBeFloatingWindow();
    if (shouldBeFloatingWindow) {
      setupFloatingWindow(
          R.dimen.session_details_floating_width, R.dimen.session_details_floating_height, 1, 0.4f);
    }

    super.onCreate(savedInstanceState);
    setContentView(R.layout.session_detail_act);

    final Toolbar toolbar = getActionBarToolbar();
    toolbar.setNavigationIcon(shouldBeFloatingWindow ? R.drawable.ic_ab_close : R.drawable.ic_up);
    toolbar.setNavigationContentDescription(R.string.close_and_go_back);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            finish();
          }
        });
    mHandler.post(
        new Runnable() {
          @Override
          public void run() {
            // Do not display the Activity name in the toolbar
            toolbar.setTitle("");
          }
        });

    if (savedInstanceState == null) {
      Uri sessionUri = getIntent().getData();
      BeamUtils.setBeamSessionUri(this, sessionUri);
    }

    mSessionUri = getIntent().getData();

    if (mSessionUri == null) {
      LOGE(TAG, "SessionDetailActivity started with null session Uri!");
      finish();
      return;
    }

    addPresenterFragment(
        R.id.session_detail_frag,
        new SessionDetailModel(mSessionUri, getApplicationContext(), new SessionsHelper(this)),
        SessionDetailQueryEnum.values(),
        SessionDetailUserActionEnum.values());
  }
  @TargetApi(Build.VERSION_CODES.LOLLIPOP)
  private void initData() {

    ArrayList<String> tabList = new ArrayList<>();
    tabList.add("Tab1");
    tabList.add("Tab2");
    tabList.add("Tab3");

    mTabLayout.setTabMode(TabLayout.MODE_FIXED);

    mTabLayout.addTab(mTabLayout.newTab().setText(tabList.get(0)));
    mTabLayout.addTab(mTabLayout.newTab().setText(tabList.get(1)));
    mTabLayout.addTab(mTabLayout.newTab().setText(tabList.get(2)));

    ArrayList<Fragment> viewList = new ArrayList<>();

    for (int i = 0; i < tabList.size(); i++) {
      Fragment f1 = new TabFragment();
      Bundle bundle = new Bundle();
      bundle.putString("content", "http://blog.csdn.net/feiduclear_up \n CSDN 废墟的树");
      f1.setArguments(bundle);
      viewList.add(f1);
    }

    TabFragmentAdapter fragmentAdapter =
        new TabFragmentAdapter(getFragmentManager(), viewList, tabList);
    viewPager.setAdapter(fragmentAdapter); // 给ViewPager设置适配器
    mTabLayout.setupWithViewPager(viewPager); // 将TabLayout和ViewPager关联起来。
    mTabLayout.setTabsFromPagerAdapter(fragmentAdapter); // 给Tabs设置适配器

    mToolbar.setLogo(R.mipmap.ic_launcher);
    mToolbar.setLogoDescription("齐鲁壹点");

    mToolbar.setNavigationIcon(R.mipmap.small_logo);
    mToolbar.setNavigationContentDescription("测试");
    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Toast.makeText(CustomCoordinatorActivity.this, "HHHHHH", Toast.LENGTH_SHORT).show();
          }
        });
  }
Esempio n. 7
0
 public void setNavigationContentDescription(int i) {
     setNavigationContentDescription(i != 0 ? getContext().getText(i) : null);
 }
Esempio n. 8
0
 public Toolbar(Context context, AttributeSet attributeSet, int i) {
     super(a(context, attributeSet, i), attributeSet, i);
     this.t = new qu();
     this.u = 8388627;
     this.A = new ArrayList();
     this.B = new int[2];
     this.D = new uv(this);
     this.L = new uw(this);
     rn a = rn.a(getContext(), attributeSet, nv.Toolbar, i, 0);
     this.l = a.f(nv.Toolbar_titleTextAppearance, 0);
     this.m = a.f(nv.Toolbar_subtitleTextAppearance, 0);
     this.u = a.b(nv.Toolbar_android_gravity, this.u);
     this.n = 48;
     int c = a.c(nv.Toolbar_titleMargins, 0);
     this.s = c;
     this.r = c;
     this.q = c;
     this.p = c;
     c = a.c(nv.Toolbar_titleMarginStart, -1);
     if (c >= 0) {
         this.p = c;
     }
     c = a.c(nv.Toolbar_titleMarginEnd, -1);
     if (c >= 0) {
         this.q = c;
     }
     c = a.c(nv.Toolbar_titleMarginTop, -1);
     if (c >= 0) {
         this.r = c;
     }
     c = a.c(nv.Toolbar_titleMarginBottom, -1);
     if (c >= 0) {
         this.s = c;
     }
     this.o = a.d(nv.Toolbar_maxButtonHeight, -1);
     c = a.c(nv.Toolbar_contentInsetStart, Integer.MIN_VALUE);
     int c2 = a.c(nv.Toolbar_contentInsetEnd, Integer.MIN_VALUE);
     this.t.b(a.d(nv.Toolbar_contentInsetLeft, 0), a.d(nv.Toolbar_contentInsetRight, 0));
     if (!(c == Integer.MIN_VALUE && c2 == Integer.MIN_VALUE)) {
         this.t.a(c, c2);
     }
     this.g = a.a(nv.Toolbar_collapseIcon);
     this.h = a.b(nv.Toolbar_collapseContentDescription);
     CharSequence b = a.b(nv.Toolbar_title);
     if (!TextUtils.isEmpty(b)) {
         setTitle(b);
     }
     b = a.b(nv.Toolbar_subtitle);
     if (!TextUtils.isEmpty(b)) {
         setSubtitle(b);
     }
     this.j = getContext();
     setPopupTheme(a.f(nv.Toolbar_popupTheme, 0));
     Drawable a2 = a.a(nv.Toolbar_navigationIcon);
     if (a2 != null) {
         setNavigationIcon(a2);
     }
     b = a.b(nv.Toolbar_navigationContentDescription);
     if (!TextUtils.isEmpty(b)) {
         setNavigationContentDescription(b);
     }
     this.K = a.d(nv.Toolbar_android_minHeight, 0);
     a.b();
     this.M = a.c();
 }