Java Code Examples for de.mrapp.android.util.ThemeUtil#getDimensionPixelSize()
The following examples show how to use
de.mrapp.android.util.ThemeUtil#getDimensionPixelSize() .
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: MainActivity.java From ChromeLikeTabSwitcher with Apache License 2.0 | 5 votes |
/** * Creates a listener, which allows to apply the window insets to the tab switcher's padding. * * @return The listener, which has been created, as an instance of the type {@link * OnApplyWindowInsetsListener}. The listener may not be nullFG */ @NonNull private OnApplyWindowInsetsListener createWindowInsetsListener() { return new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(final View v, final WindowInsetsCompat insets) { int left = insets.getSystemWindowInsetLeft(); int top = insets.getSystemWindowInsetTop(); int right = insets.getSystemWindowInsetRight(); int bottom = insets.getSystemWindowInsetBottom(); tabSwitcher.setPadding(left, top, right, bottom); float touchableAreaTop = top; if (tabSwitcher.getLayout() == Layout.TABLET) { touchableAreaTop += getResources() .getDimensionPixelSize(R.dimen.tablet_tab_container_height); } RectF touchableArea = new RectF(left, touchableAreaTop, getDisplayWidth(MainActivity.this) - right, touchableAreaTop + ThemeUtil.getDimensionPixelSize(MainActivity.this, R.attr.actionBarSize)); tabSwitcher.addDragGesture( new SwipeGesture.Builder().setTouchableArea(touchableArea).create()); tabSwitcher.addDragGesture( new PullDownGesture.Builder().setTouchableArea(touchableArea).create()); return insets; } }; }
Example 2
Source File: PreferenceFragment.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the elevation of the button bar from the activity's current theme. */ private void obtainButtonBarElevation() { int elevation; try { elevation = ThemeUtil .getDimensionPixelSize(getActivity(), R.attr.restoreDefaultsButtonBarElevation); } catch (NotFoundException e) { elevation = getResources().getDimensionPixelSize(R.dimen.button_bar_elevation); } setButtonBarElevation(pixelsToDp(getActivity(), elevation)); }
Example 3
Source File: PreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the width of the navigation from the activity's theme. */ private void obtainNavigationWidth() { int navigationWidth; try { navigationWidth = ThemeUtil.getDimensionPixelSize(this, R.attr.navigationWidth); } catch (NotFoundException e) { navigationWidth = getResources().getDimensionPixelSize(R.dimen.navigation_width); } setNavigationWidth(navigationWidth); }
Example 4
Source File: PreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the elevation of the activity's toolbar from the activity's theme. */ private void obtainToolbarElevation() { int elevation; try { elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.toolbarElevation); } catch (NotFoundException e) { elevation = getResources().getDimensionPixelSize(R.dimen.toolbar_elevation); } setToolbarElevation(pixelsToDp(this, elevation)); }
Example 5
Source File: PreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the elevation of the toolbar, which is used to show the bread crumb of the currently * selected preference fragment, when using the split screen layout. */ private void obtainBreadcrumbElevation() { int elevation; try { elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.breadCrumbElevation); } catch (NotFoundException e) { elevation = getResources().getDimensionPixelSize(R.dimen.bread_crumb_toolbar_elevation); } setBreadCrumbElevation(pixelsToDp(this, elevation)); }
Example 6
Source File: PreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the elevation of the card view, which contains the currently shown preference * fragment, when using the split screen layout, from the activity's theme. */ private void obtainCardViewElevation() { int elevation; try { elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.cardViewElevation); } catch (NotFoundException e) { elevation = getResources().getDimensionPixelSize(R.dimen.card_view_elevation); } setCardViewElevation(pixelsToDp(this, elevation)); }
Example 7
Source File: PreferenceActivity.java From AndroidPreferenceActivity with Apache License 2.0 | 5 votes |
/** * Obtains the elevation of the button bar, which is shown when using the activity as a wizard, * from the activity's theme. */ private void obtainButtonBarElevation() { int elevation; try { elevation = ThemeUtil.getDimensionPixelSize(this, R.attr.buttonBarElevation); } catch (NotFoundException e) { elevation = getResources().getDimensionPixelSize(R.dimen.button_bar_elevation); } setButtonBarElevation(pixelsToDp(this, elevation)); }