Visual back-port of the rotating drawer-to-arrow drawable from Android L

Overview

DrawerArrowDrawable

A simple drawable backport of the new drawer-indicator/back-arrow rotating drawable from the upcoming Android L.

License

Copyright 2014 Chris Renke

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Version you can manually toggle

    Version you can manually toggle

    Would you be interested in something like this:

    public class DrawerIndicatorDrawable extends DrawerArrowDrawable implements ValueAnimator.AnimatorUpdateListener {
        private final ValueAnimator mValueAnimator;
    
        public DrawerIndicatorDrawable(final Resources resources) {
            super(resources);
            mValueAnimator = new ValueAnimator();
            mValueAnimator.addUpdateListener(this);
        }
    
        public DrawerIndicatorDrawable(final Resources resources, final boolean rounded) {
            super(resources, rounded);
            mValueAnimator = new ValueAnimator();
            mValueAnimator.addUpdateListener(this);
        }
    
        public void setToArrow() {
            super.setFlip(true);
            restartAnimatorTo(1f);
        }
    
        public void setToDrawer() {
            super.setFlip(false);
            restartAnimatorTo(0f);
        }
    
        public void restartAnimatorTo(final float targetParameter) {
            mValueAnimator.cancel();
            mValueAnimator.setObjectValues(this.parameter, targetParameter);
            mValueAnimator.start();
        }
    
        @Override
        public void onAnimationUpdate(final ValueAnimator animation) {
            final float value = (Float) animation.getAnimatedValue();
            super.setParameter(value);
        }
    
        @Override
        public void setFlip(final boolean flip) {
            mValueAnimator.cancel();
            super.setFlip(flip);
        }
    
        @Override public void setParameter(final float parameter) {
            mValueAnimator.cancel();
            super.setParameter(parameter);
        }
    }
    

    I have a use case where I want to animate to or from the arrow whenever the drawer is locked/unlocked.

    opened by yarian 0
  • Update build.gradle

    Update build.gradle

    The Issue no 11 is resolved by changing - runProguard false to minifyEnabled false Note - Gradle must be 2.2 or above to use minifyEnabled

    Also build tools changed to 21.0.0 to resolve following error -

    Error:Execution failed for task ':app:transformClassesWithDexForDebug'.

    com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Multi dex requires Build Tools 21.0.0 / Current: 20

    opened by Masquerade0097 0
  •  Unable to Build due to - Error: Could not find method runProguard() for arguments [false] on BuildType_Decorated

    Unable to Build due to - Error: Could not find method runProguard() for arguments [false] on BuildType_Decorated

    Error message - Could not find method runProguard() for arguments [false] on BuildType_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=[], mConsumerProguardFiles=[], mManifestPlaceholders={}} of type com.android.build.gradle.internal.dsl.BuildType.

    opened by Masquerade0097 0
  • GIF in readme has bad framerate

    GIF in readme has bad framerate

    The GIF linked in the readme is 1.6 MB, and playback is super stuttery on my machine.

    I ran it through ImageOptim, and it came out pixel-for-pixel identical, but 6× smaller and with much smoother playback. I would submit a pull request, but the gif isn't hosted in this repo (perhaps it should be?).

    smaller version of the same gif

    opened by ZevEisenberg 0
  • Issue with setting DrawerArrowDrawable as the ActionBar icon.

    Issue with setting DrawerArrowDrawable as the ActionBar icon.

    Edit: DrawerArrowDrawable needs to override getConstantState or it will throw a NullPointerException here: https://github.com/android/platform_frameworks_base/blob/kitkat-release/core/java/com/android/internal/widget/ActionBarView.java#L1637


    I am using DrawerArrowDrawable with SlidingMenu and it works great. However, when I tried adding android.widget.SearchView in the menu it crashes the app.

    E/AndroidRuntime( 4635): java.lang.NullPointerException
    E/AndroidRuntime( 4635):    at com.android.internal.widget.ActionBarView$ExpandedActionViewMenuPresenter.expandItemActionView(ActionBarView.java:1711)
    E/AndroidRuntime( 4635):    at com.android.internal.view.menu.MenuBuilder.expandItemActionView(MenuBuilder.java:1236)
    E/AndroidRuntime( 4635):    at com.android.internal.view.menu.MenuItemImpl.expandActionView(MenuItemImpl.java:625)
    E/AndroidRuntime( 4635):    at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:879)
    E/AndroidRuntime( 4635):    at com.android.internal.view.menu.ActionMenuView.invokeItem(ActionMenuView.java:558)
    E/AndroidRuntime( 4635):    at com.android.internal.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:187)
    E/AndroidRuntime( 4635):    at com.htc.internal.widget.HtcScaleAnimController.onClick(HtcScaleAnimController.java:334)
    E/AndroidRuntime( 4635):    at android.view.View.performClick(View.java:4480)
    E/AndroidRuntime( 4635):    at android.view.View$PerformClick.run(View.java:18686)
    E/AndroidRuntime( 4635):    at android.os.Handler.handleCallback(Handler.java:733)
    E/AndroidRuntime( 4635):    at android.os.Handler.dispatchMessage(Handler.java:95)
    E/AndroidRuntime( 4635):    at android.os.Looper.loop(Looper.java:157)
    E/AndroidRuntime( 4635):    at android.app.ActivityThread.main(ActivityThread.java:5872)
    E/AndroidRuntime( 4635):    at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime( 4635):    at java.lang.reflect.Method.invoke(Method.java:515)
    E/AndroidRuntime( 4635):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:852)
    E/AndroidRuntime( 4635):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:668)
    E/AndroidRuntime( 4635):    at dalvik.system.NativeStart.main(Native Method)
    

    To reproduce this issue:

    1. Create a new Activity.
    2. Set DrawerArrowDrawable as the ActionBar icon:
    getActionBar().setIcon(new DrawerArrowDrawable(getResources()));
    
    1. Add a SearchView to the ActionBar
    <?xml version="1.0" encoding="utf-8"?>
    <menu xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item
            android:id="@+id/search"
            android:actionViewClass="android.widget.SearchView"
            android:icon="@drawable/ic_action_search"
            android:showAsAction="ifRoom|collapseActionView"
            android:title="@string/search"/>
    
    </menu>
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.options_menu, menu);
        return true;
    }
    
    1. Click on the search MenuItem that should display the SearchView in the action bar,
    opened by jaredrummler 0
Owner
Chris Renke
Eng @ Riot Games Former Android Engeering @ Uber & Square Inc
Chris Renke
An Android library that help you to build app with swipe back gesture.

SwipeBackLayout An Android library that help you to build app with swipe back gesture. Demo Apk GooglePlay Requirement The latest android-support-v4.j

ike_w0ng 6.1k Jan 3, 2023
Android drawer icon with material design animation

LDrawer Android drawer icon with material design animation Note Basically same as appcompat_v7 version 21, you can use appcompat_v7 compile 'com.andro

Hasan Keklik 1.4k Dec 25, 2022
swipe display drawer with flowing & bouncing effects.

FlowingDrawer swipe right to display drawer with flowing effects. Download Include the following dependency in your build.gradle file. Gradle: rep

mxn 2.6k Jan 3, 2023
Navigation Drawer Activity with material design style and simplified methods

MaterialNavigationDrawer Navigation Drawer Activity with material design style and simplified methods       It requires 10+ API and android support v7

Fabio Biola 1.6k Dec 30, 2022
A beautiful leanback port for Smartphones and Tablets

MaterialLeanBack A beautiful leanback port for Smartphones and Tablets Sample Usage In your layout <com.github.florent37.materialleanback.MaterialLean

Florent CHAMPIGNY 739 Aug 2, 2022
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube graphic component.

Draggable Panel DEPRECATED. This project is not maintained anymore. Draggable Panel is an Android library created to build a draggable user interface

Pedro Vicente Gómez Sánchez 3k Jan 5, 2023
Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your development.

Bubbles for Android Bubbles for Android is an Android library to provide chat heads capabilities on your apps. With a fast way to integrate with your

Txus Ballesteros 1.5k Jan 2, 2023
Android library used to create an awesome Android UI based on a draggable element similar to the last YouTube New graphic component.

Please switch to DragView, for the best support, thank you DraggablePanel Download allprojects { repositories { ... maven { url 'https://jitp

Hoàng Anh Tuấn 103 Oct 12, 2022
FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

FixedHeaderTableLayout is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells with scrolling and zooming features. FixedHeaderTableLayout is similar in construction and use as to Android's TableLayout

null 33 Dec 8, 2022
A wave view of android,can be used as progress bar.

WaveView ![Gitter](https://badges.gitter.im/Join Chat.svg) A wave view of android,can be used as progress bar. Screenshot APK demo.apk What can be use

Kai Wang 1.3k Dec 28, 2022
An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu

ResideLayout An Android Layout which has a same function like https://github.com/romaonthego/RESideMenu. Can be used on Android 1.6(I haven't try it.)

Yang Hui 392 Oct 12, 2022
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.

This project isn't maintained anymore. It is now recommended to use https://github.com/peterLaurence/MapView. MapView is maintained by Peter, one of o

Mike Dunn 1.5k Nov 21, 2022
Ultra Pull to Refresh for Android. Support all the views.

Welcome to follow me on GitHub or Twitter GitHub: https://github.com/liaohuqiu Twitter: https://twitter.com/liaohuqiu 中文版文档 Wanna auto-load-more? This

Huqiu Liao 9.6k Jan 5, 2023
SwipeBack is an android library that can finish a activity by using gesture.

SwipeBack SwipeBack is a android library that can finish a activity by using gesture. You can set the swipe direction,such as left,top,right and botto

Eric 1.7k Nov 21, 2022
A very simple arc layout library for Android

ArcLayout A very simple arc layout library for Android. Try out the sample application on the Play Store. Usage (For a working implementation of this

ogaclejapan 1.4k Dec 26, 2022
Android layout that simulates physics using JBox2D

PhysicsLayout Android layout that simulates physics using JBox2D. Simply add views, enable physics, and watch them fall! See it in action with the sam

John Carlson 689 Dec 29, 2022
Android component which presents a dismissible view from the bottom of the screen

BottomSheet BottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replaceme

Flipboard 4.5k Dec 28, 2022
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.4k Dec 31, 2022
Allows the easy creation of animated transition effects when the state of Android UI has changed

android-transition Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general e

Kai 615 Nov 14, 2022