Java Code Examples for androidx.appcompat.widget.Toolbar#findViewById()
The following examples show how to use
androidx.appcompat.widget.Toolbar#findViewById() .
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: UCropActivity.java From EasyPhotos with Apache License 2.0 | 6 votes |
/** * Configures and styles both status bar and toolbar. */ private void setupAppBar() { setStatusBarColor(mStatusBarColor); final Toolbar toolbar = findViewById(R.id.toolbar); // Set all of the Toolbar coloring toolbar.setBackgroundColor(mToolbarColor); toolbar.setTitleTextColor(mToolbarWidgetColor); final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title); toolbarTitle.setTextColor(mToolbarWidgetColor); toolbarTitle.setText(mToolbarTitle); // Color buttons inside the Toolbar Drawable stateButtonDrawable = ContextCompat.getDrawable(this, mToolbarCancelDrawable).mutate(); stateButtonDrawable.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); toolbar.setNavigationIcon(stateButtonDrawable); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } }
Example 2
Source File: PictureMultiCuttingActivity.java From Matisse-Kotlin with Apache License 2.0 | 6 votes |
/** * Configures and styles both status bar and toolbar. */ private void setupAppBar() { setStatusBarColor(mStatusBarColor); final Toolbar toolbar = findViewById(R.id.toolbar); // Set all of the Toolbar coloring toolbar.setBackgroundColor(mToolbarColor); toolbar.setTitleTextColor(mToolbarWidgetColor); final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title); toolbarTitle.setTextColor(mToolbarWidgetColor); toolbarTitle.setText(mToolbarTitle); // Color buttons inside the Toolbar Drawable stateButtonDrawable = ContextCompat.getDrawable(this, mToolbarCancelDrawable).mutate(); stateButtonDrawable.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); toolbar.setNavigationIcon(stateButtonDrawable); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } }
Example 3
Source File: UCropActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * Configures and styles both status bar and toolbar. */ private void setupAppBar() { setStatusBarColor(mStatusBarColor); final Toolbar toolbar = findViewById(R.id.toolbar); // Set all of the Toolbar coloring toolbar.setBackgroundColor(mToolbarColor); toolbar.setTitleTextColor(mToolbarWidgetColor); final TextView toolbarTitle = toolbar.findViewById(R.id.toolbar_title); toolbarTitle.setTextColor(mToolbarWidgetColor); toolbarTitle.setText(mToolbarTitle); // Color buttons inside the Toolbar Drawable stateButtonDrawable = AppCompatResources.getDrawable(this, mToolbarCancelDrawable).mutate(); stateButtonDrawable.setColorFilter(mToolbarWidgetColor, PorterDuff.Mode.SRC_ATOP); toolbar.setNavigationIcon(stateButtonDrawable); setSupportActionBar(toolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } }
Example 4
Source File: DataLegendActivity.java From proofmode with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_data_legend); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); TextView title = toolbar.findViewById(R.id.toolbar_title); title.setText(getTitle()); WebView webView = findViewById(R.id.webView); WebSettings webSetting = webView.getSettings(); webSetting.setBuiltInZoomControls(false); webSetting.setJavaScriptEnabled(false); webView.setWebViewClient(new WebViewClient()); webView.loadUrl("file:///android_asset/datalegend/datalegend.html"); }
Example 5
Source File: DownloadsToolbarTutorial.java From Aria2App with GNU General Public License v3.0 | 5 votes |
public final void buildSequence(@NonNull Toolbar toolbar) { if (toolbar.findViewById(R.id.main_search) != null) add(forToolbarMenuItem(toolbar, R.id.main_search, R.string.tutorial_search) .fitSystemWindows(true) .enableAutoTextPosition() .focusShape(FocusShape.CIRCLE)); if (toolbar.findViewById(R.id.main_filter) != null) add(forToolbarMenuItem(toolbar, R.id.main_filter, R.string.tutorial_filters) .fitSystemWindows(true) .enableAutoTextPosition() .focusShape(FocusShape.CIRCLE)); }
Example 6
Source File: DigitalSignaturesActivity.java From proofmode with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_digital_signatures); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); TextView title = toolbar.findViewById(R.id.toolbar_title); title.setText(getTitle()); }
Example 7
Source File: FetchPreferencesActivity.java From mage-android with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fetch_preferences); toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.inflateMenu(R.menu.fetch_preferences_menu); noContentView = findViewById(R.id.no_content_frame); boolean fetchEnabled = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getResources().getString(R.string.dataFetchEnabledKey), getResources().getBoolean(R.bool.dataFetchEnabledDefaultValue)); SwitchCompat dataEnabledSwitch = (SwitchCompat) toolbar.findViewById(R.id.toolbar_switch); dataEnabledSwitch.setChecked(fetchEnabled); dataEnabledSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { PreferenceManager.getDefaultSharedPreferences(FetchPreferencesActivity.this).edit().putBoolean(getResources().getString(R.string.dataFetchEnabledKey), isChecked).commit(); updateView(isChecked); } }); updateView(fetchEnabled); getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, preference).commit(); }
Example 8
Source File: ToolbarTapTarget.java From TapTargetView with Apache License 2.0 | 4 votes |
ToolbarTapTarget(Toolbar toolbar, @IdRes int menuItemId, CharSequence title, @Nullable CharSequence description) { super(toolbar.findViewById(menuItemId), title, description); }