android.support.v7.graphics.drawable.DrawerArrowDrawable Java Examples
The following examples show how to use
android.support.v7.graphics.drawable.DrawerArrowDrawable.
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: ConfigurationHelper.java From candybar-library with Apache License 2.0 | 6 votes |
public static Drawable getNavigationIcon(@NonNull Context context, @NonNull CandyBarApplication.NavigationIcon navigationIcon) { switch (navigationIcon) { case DEFAULT: return new DrawerArrowDrawable(context); case STYLE_1: return get(context, R.drawable.ic_toolbar_navigation); case STYLE_2: return get(context, R.drawable.ic_toolbar_navigation_2); case STYLE_3: return get(context, R.drawable.ic_toolbar_navigation_3); case STYLE_4: return get(context, R.drawable.ic_toolbar_navigation_4); default: return get(context, R.drawable.ic_toolbar_navigation); } }
Example #2
Source File: MainActivity.java From FantasySlide with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getSupportActionBar().setDisplayHomeAsUpEnabled(true); final DrawerArrowDrawable indicator = new DrawerArrowDrawable(this); indicator.setColor(Color.WHITE); getSupportActionBar().setHomeAsUpIndicator(indicator); setTransformer(); // setListener(); drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); drawerLayout.setScrimColor(Color.TRANSPARENT); drawerLayout.addDrawerListener(new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { if (((ViewGroup) drawerView).getChildAt(1).getId() == R.id.leftSideBar) { indicator.setProgress(slideOffset); } } }); }
Example #3
Source File: BreadcrumbActivity.java From BreadcrumbToolbar with Apache License 2.0 | 6 votes |
private void bindViews() { // Bind toolbar toolbar = (BreadcrumbToolbar) findViewById(R.id.toolbar); // We can't use setSupportActionBar() toolbar.setBreadcrumbToolbarListener(this); toolbar.setTitle(R.string.app_name); // Set animated drawer icon to toolbar DrawerArrowDrawable drawerArrow = new DrawerArrowDrawable(this); drawerArrow.setColor(ContextCompat.getColor(this, android.R.color.white)); toolbar.setNavigationIcon(drawerArrow); getSupportFragmentManager().addOnBackStackChangedListener(this); // Bind drawer and toggle button drawer = (DrawerLayout) findViewById(R.id.drawer_layout); bindDrawerToggle(); NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view); navigationView.setNavigationItemSelectedListener(this); navigationView.setCheckedItem(R.id.nav_home); // Bind FAB fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(this::openBreadCrumbFragment); }
Example #4
Source File: BreadcrumbToolbar.java From BreadcrumbToolbar with Apache License 2.0 | 6 votes |
public void initToolbar(BreadcrumbToolbarItem object) { LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); breadcrumbScrollView = (BreadcrumbScrollView) inflater.inflate(R.layout.breadcrumb_scroll_view, null); breadcrumbScrollView.setBreadcrumbItemCallback(this); addView(breadcrumbScrollView); // Breadcrumb scroll view is now initialized and needs its first root element addItem(object); // Animate toolbar toggle icon if exists, set navigation back icon otherwise. if (getNavigationIcon() instanceof DrawerArrowDrawable) { animateNavigationIcon(((DrawerArrowDrawable) getNavigationIcon()), true); } else { initNavigationListener(true); } // Primary title needs to be saved if (getTitle() != null) { toolbarTitle = getTitle().toString(); } // Clear toolbar title on breadcrumb before adding breadcrumbs setTitle(""); }
Example #5
Source File: BreadcrumbToolbar.java From BreadcrumbToolbar with Apache License 2.0 | 6 votes |
public void cleanToolbar() { if (breadcrumbScrollView != null) { toolbarItemStack.removeAllElements(); if (getNavigationIcon() instanceof DrawerArrowDrawable) { // Animate navigation icon animateNavigationIcon(((DrawerArrowDrawable) getNavigationIcon()), false); } else { // Navigation icon must be removed if none existed setNavigationIcon(null); } // Remove scroll view removeView(breadcrumbScrollView); breadcrumbScrollView = null; // Reset the toolbar title setTitle(toolbarTitle); } }
Example #6
Source File: FloatingSearchView.java From floatingsearchview with Apache License 2.0 | 6 votes |
private void openMenuDrawable(final DrawerArrowDrawable drawerArrowDrawable, boolean withAnim) { if (withAnim) { ValueAnimator anim = ValueAnimator.ofFloat(0.0f, 1.0f); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (Float) animation.getAnimatedValue(); drawerArrowDrawable.setProgress(value); } }); anim.setDuration(MENU_ICON_ANIM_DURATION); anim.start(); } else { drawerArrowDrawable.setProgress(1.0f); } }
Example #7
Source File: FloatingSearchView.java From floatingsearchview with Apache License 2.0 | 6 votes |
private void closeMenuDrawable(final DrawerArrowDrawable drawerArrowDrawable, boolean withAnim) { if (withAnim) { ValueAnimator anim = ValueAnimator.ofFloat(1.0f, 0.0f); anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { float value = (Float) animation.getAnimatedValue(); drawerArrowDrawable.setProgress(value); } }); anim.setDuration(MENU_ICON_ANIM_DURATION); anim.start(); } else { drawerArrowDrawable.setProgress(0.0f); } }
Example #8
Source File: ViewTextActivity.java From android-storage with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); String name = getIntent().getStringExtra(EXTRA_FILE_NAME); mPath = getIntent().getStringExtra(EXTRA_FILE_PATH); setContentView(R.layout.activity_view_text_file); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); DrawerArrowDrawable drawerDrawable = new DrawerArrowDrawable(this); drawerDrawable.setColor(getResources().getColor(android.R.color.white)); drawerDrawable.setProgress(1f); toolbar.setNavigationIcon(drawerDrawable); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(name); getSupportActionBar().setHomeButtonEnabled(true); mContentView = (TextView) findViewById(R.id.content); mStorage = new Storage(this); byte[] bytes = mStorage.readFile(mPath); mContentView.setText(new String(bytes)); }
Example #9
Source File: MainActivity.java From android-moving-toolbar with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // set content view binding = DataBindingUtil.setContentView(this, R.layout.activity_main); // set support action bar binding.toolbar.setNavigationIcon(new DrawerArrowDrawable(this)); setSupportActionBar(binding.toolbar); // set moving toolbar helper = new MovingToolbarHelper(); helper.bind( binding.nestedScrollView, binding.imageView, binding.imageContainer, binding.toolbarContainer, binding.contentContainer); }
Example #10
Source File: ViewTextActivity.java From android-storage with Apache License 2.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); String name = getIntent().getStringExtra(EXTRA_FILE_NAME); mPath = getIntent().getStringExtra(EXTRA_FILE_PATH); setContentView(R.layout.activity_view_text_file); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); DrawerArrowDrawable drawerDrawable = new DrawerArrowDrawable(this); drawerDrawable.setColor(getResources().getColor(android.R.color.white)); drawerDrawable.setProgress(1f); toolbar.setNavigationIcon(drawerDrawable); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(name); getSupportActionBar().setHomeButtonEnabled(true); mContentView = (TextView) findViewById(R.id.content); mStorage = new Storage(this); byte[] bytes = mStorage.readFile(mPath); mContentView.setText(new String(bytes)); }
Example #11
Source File: CandyBarMainActivity.java From candybar-library with Apache License 2.0 | 5 votes |
@Override public void onSearchExpanded(boolean expand) { Toolbar toolbar = findViewById(R.id.toolbar); mIsMenuVisible = !expand; if (expand) { int color = ColorHelper.getAttributeColor(this, R.attr.toolbar_icon); toolbar.setNavigationIcon(DrawableHelper.getTintedDrawable( this, R.drawable.ic_toolbar_back, color)); toolbar.setNavigationOnClickListener(view -> onBackPressed()); } else { SoftKeyboardHelper.closeKeyboard(this); ColorHelper.setStatusBarColor(this, Color.TRANSPARENT, true); if (CandyBarApplication.getConfiguration().getNavigationIcon() == CandyBarApplication.NavigationIcon.DEFAULT) { mDrawerToggle.setDrawerArrowDrawable(new DrawerArrowDrawable(this)); } else { toolbar.setNavigationIcon(ConfigurationHelper.getNavigationIcon(this, CandyBarApplication.getConfiguration().getNavigationIcon())); } toolbar.setNavigationOnClickListener(view -> mDrawerLayout.openDrawer(GravityCompat.START)); } mDrawerLayout.setDrawerLockMode(expand ? DrawerLayout.LOCK_MODE_LOCKED_CLOSED : DrawerLayout.LOCK_MODE_UNLOCKED); supportInvalidateOptionsMenu(); }
Example #12
Source File: Utils.java From IPTVFree with Apache License 2.0 | 5 votes |
/** * Get hamburger icon on navigation drawer * @param toolbar Toolbar * @return View */ private static View getNavButtonInToolBar(Toolbar toolbar) { for (int i = 0;i<toolbar.getChildCount();i++) { if(toolbar.getChildAt(i) instanceof ImageButton){ ImageButton button = (ImageButton) toolbar.getChildAt(i); if(button.getDrawable().getClass().getSuperclass().equals(DrawerArrowDrawable.class)) return toolbar.getChildAt(i); } } return null; }
Example #13
Source File: BrowsingActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 4 votes |
protected void inflateUi(@Nullable Bundle savedInstanceState) { setContentView(R.layout.activity_browsing); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerArrowDrawable drawerArrow = new DrawerArrowDrawable(this); drawerArrow.setColor(0xFFFFFF); toolbar.setNavigationIcon(drawerArrow); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); supportActionBar.setDisplayShowTitleEnabled(false); } mBooksInformationDbHelper = BooksInformationDbHelper.getInstance(BrowsingActivity.this); appBarLayout = findViewById(R.id.appBar); DrawerLayout drawer = findViewById(R.id.drawer_layout); actionBarDrawerToggle = new ActionBarDrawerToggle( this, drawer, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.addDrawerListener(actionBarDrawerToggle); actionBarDrawerToggle.syncState(); NavigationView navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); toolbarDownloadOnlySwitch = findViewById(R.id.toolbar_downloaded_only_switch); navDownloadedOnlySwitch = (SwitchCompat) navigationView.getMenu().findItem(R.id.nav_item_downloaded_only).getActionView(); SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE); mShouldDisplayDownloadOnly = sharedPref.getBoolean(KEY_DOWNLOADED_ONLY, false); setToolbarDownloadOnlySwitchNoCallBack(mShouldDisplayDownloadOnly); setDownloadOnlySwitchNoCallBack(mShouldDisplayDownloadOnly); toolbarDownloadOnlySwitch.setCheckedChangeListener(v -> switchDownloadOnlyFilter(!shouldDisplayDownloadedOnly())); navDownloadedOnlySwitch.setOnCheckedChangeListener((buttonView, isChecked) -> switchDownloadOnlyFilter(isChecked)); //this is done to prevent motion of drawer when the user tries to slide thes switch navDownloadedOnlySwitch.setOnTouchListener((v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { v.getParent().requestDisallowInterceptTouchEvent(true); } return false; }); View filterPagerContainer = findViewById(R.id.filter_pager_container); bookListContainer = findViewById(R.id.book_list_container); View bookInfoContainer = findViewById(R.id.book_info_container); FragmentManager fragmentManager = getSupportFragmentManager(); mPaneNumber = getmumberOfpans(filterPagerContainer, bookInfoContainer); @Nullable BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_navigation); int oldPanNumbers = savedInstanceState == null ? 0 : savedInstanceState.getInt(NUMBER_OF_PANS_KEY); browsingActivityNavigationController = BrowsingActivityNavigationController.create( mPaneNumber, oldPanNumbers, fragmentManager, savedInstanceState != null, this, bottomNavigationView, this); if (browsingActivityNavigationController != null) { browsingActivityNavigationController.intiializePans(); if (bottomNavigationView != null) { bottomNavigationView.setOnNavigationItemSelectedListener(browsingActivityNavigationController::handleButtomNavigationItem); } } appRateController = new AppRateController(this); appRateController .monitor() .showRateDialogIfMeetsConditions(this); }
Example #14
Source File: FloatingSearchView.java From floatingsearchview with Apache License 2.0 | 4 votes |
private void initDrawables() { mMenuBtnDrawable = new DrawerArrowDrawable(getContext()); mIconClear = Util.getWrappedDrawable(getContext(), R.drawable.ic_clear_black_24dp); mIconBackArrow = Util.getWrappedDrawable(getContext(), R.drawable.ic_arrow_back_black_24dp); mIconSearch = Util.getWrappedDrawable(getContext(), R.drawable.ic_search_black_24dp); }