Java Code Examples for android.support.v7.widget.Toolbar#setContentInsetsAbsolute()
The following examples show how to use
android.support.v7.widget.Toolbar#setContentInsetsAbsolute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseActivity.java From actor-platform with GNU Affero General Public License v3.0 | 6 votes |
protected void setToolbar(View view, ActionBar.LayoutParams params, boolean enableBack) { if (getSupportActionBar() == null) { throw new RuntimeException("Action bar is not set!"); } getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setCustomView(view, params); if (enableBack) { getSupportActionBar().setDisplayShowHomeEnabled(true); } else { getSupportActionBar().setDisplayShowHomeEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(false); Toolbar parent = (Toolbar) view.getParent(); parent.setContentInsetsAbsolute(0, 0); } }
Example 2
Source File: ChatToolbarFragment.java From actor-platform with GNU Affero General Public License v3.0 | 4 votes |
@Override public void onConfigureActionBar(ActionBar actionBar) { super.onConfigureActionBar(actionBar); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowCustomEnabled(true); // Loading Toolbar header views ActorStyle style = ActorSDK.sharedActor().style; barView = LayoutInflater.from(getActivity()).inflate(R.layout.bar_conversation, null); actionBar.setCustomView(barView, new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.MATCH_PARENT)); Toolbar parent = (Toolbar) barView.getParent(); parent.setContentInsetsAbsolute(0, 0); barView.findViewById(R.id.home).setOnClickListener(v -> { Activity activity = getActivity(); if (activity != null) { activity.onBackPressed(); } }); counter = (TextView) barView.findViewById(R.id.counter); counter.setTextColor(style.getDialogsCounterTextColor()); counter.setBackgroundResource(R.drawable.ic_counter_circle); counter.getBackground().setColorFilter(style.getDialogsCounterBackgroundColor(), PorterDuff.Mode.MULTIPLY); barTitle = (TextView) barView.findViewById(R.id.title); barSubtitleContainer = barView.findViewById(R.id.subtitleContainer); barTypingIcon = (ImageView) barView.findViewById(R.id.typingImage); barTypingIcon.setImageDrawable(new TypingDrawable()); barTyping = (TextView) barView.findViewById(R.id.typing); barSubtitle = (TextView) barView.findViewById(R.id.subtitle); barTypingContainer = barView.findViewById(R.id.typingContainer); barTypingContainer.setVisibility(View.INVISIBLE); barAvatar = (AvatarView) barView.findViewById(R.id.avatarPreview); barAvatar.init(Screen.dp(32), 18); barView.findViewById(R.id.titleContainer).setOnClickListener(v -> { if (peer.getPeerType() == PeerType.PRIVATE) { ActorSDKLauncher.startProfileActivity(getActivity(), peer.getPeerId()); } else if (peer.getPeerType() == PeerType.GROUP) { ActorSDK.sharedActor().startGroupInfoActivity(getActivity(), peer.getPeerId()); } else { // Nothing to do } }); }
Example 3
Source File: GLDemoActivity.java From java6-android-gldemos with Apache License 2.0 | 2 votes |
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_activity_layout); Resources resources = getResources(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setLogo(R.drawable.ic_launcher); toolbar.setTitle(R.string.app_title); toolbar.setContentInsetsAbsolute(0, 0); setSupportActionBar(toolbar); deviceGLVersion = AndroidGLESUtil.getGLVersion(this); adapter = new GLHeaderAdapter(this); adapter.addSectionHeaderItem(resources.getString(R.string.header_gles_3_0)); adapter.addItem(GLSLInvert.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslinvert"); adapter.addItem(GLSLKuwahara.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslkuwahara"); adapter.addItem(GLSLKuwaharaFBO.class, XeGLES3.GLES3_0, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles30demo-glslkuwaharafbo"); adapter.addSectionHeaderItem(resources.getString(R.string.header_gles_3_1)); adapter.addItem(ComputeBasicRayTrace.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computebasicraytrace"); adapter.addItem(ComputeInvert.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computeinvert"); adapter.addItem(ComputeInvertSampler.class, XeGLES3.GLES3_1, "https://github.com/typhonrt/modern-java6-android-gldemos/wiki/gles31demo-computeinvertsampler"); ListView listView = (ListView)findViewById(R.id.main_listview); listView.setAdapter(adapter); listView.setOnItemClickListener(this); listView.setOnItemLongClickListener(this); }