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
Drawable animation inspired by Tinder.

WaveDrawable Drawable animation inspired by Tinder. Download compile 'me.alexrs:wave-drawable:1.0.0' LinearInterpolator BounceInterpolator CycleInterp

Alejandro Rodríguez Salamanca 213 Oct 11, 2022
Drawable animation inspired by Tinder.

WaveDrawable Drawable animation inspired by Tinder. Download compile 'me.alexrs:wave-drawable:1.0.0' LinearInterpolator BounceInterpolator CycleInterp

Alejandro Rodríguez Salamanca 213 Oct 11, 2022
Custom ImageView for android with polygon shape (Android)

PolygonImageView Create a custom ImageView with polygonal forms. Usage To use PolygonImageView, add the module into your project and start to build xm

Albert Grobas 531 Dec 25, 2022
Android library to generate image avatar from the first letter of a username. Letter avatar like Gmail Android best practice

AvatarImageGenerator Generate first letter avatar Image like gmail's contact avatar. It generates an drawable that can be be set to an ImageView. Inst

Korir Amos 61 Sep 25, 2022
Implementation of ImageView for Android that supports zooming, by various touch gestures.

PhotoView PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView. [ Dependency Add this in your root build.grad

Baseflow 18.4k Dec 30, 2022
A circular ImageView for Android

CircleImageView A fast circular ImageView perfect for profile images. This is based on RoundedImageView from Vince Mi which itself is based on techniq

Henning Dodenhof 13.8k Mar 29, 2021
Android filters based on OpenGL (idea from GPUImage for iOS)

GPUImage for Android Idea from: iOS GPUImage framework Goal is to have something as similar to GPUImage as possible. Vertex and fragment shaders are e

CATS Open Source Softwares 8.6k Jan 8, 2023
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.

Subsampling Scale Image View A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) w

null 7.4k Jan 8, 2023
Android library project for cropping images

I guess people are just cropping out all the sadness An Android library project that provides a simple image cropping Activity, based on code from AOS

Jamie McDonald 4.5k Dec 29, 2022
Adds touch functionality to Android ImageView.

TouchImageView for Android Capabilities TouchImageView extends ImageView and supports all of ImageView’s functionality. In addition, TouchImageView ad

Michael Ortiz 2.4k Mar 28, 2021
Custom shaped android imageview components

Shape Image View Provides a set of custom shaped android imageview components, and a framework to define more shapes. Implements both shader and bitma

Siyamed SINIR 2.6k Mar 29, 2021
Android ImageView widget with zoom and pan capabilities

ImageViewTouch for Android ImageViewTouch is an android ImageView widget with zoom and pan capabilities. This is an implementation of the ImageView wi

Alessandro Crugnola 1.9k Jan 4, 2023
Android ImageView replacement which allows image loading from URLs or contact address book, with caching

Smart Image View for Android SmartImageView is a drop-in replacement for Android’s standard ImageView which additionally allows images to be loaded fr

James Smith 1.3k Dec 24, 2022
Implements pinch-zoom, rotate, pan as an ImageView for Android 2.1+

GestureImageView This is a simple Android View class which provides basic pinch and zoom capability for images. Can be used as a replacement for a sta

Jason 1.1k Nov 10, 2022
Custom view for circular images in Android while maintaining the best draw performance

CircularImageView Custom view for circular images in Android while maintaining the best draw performance Usage To make a circular ImageView, add this

Pkmmte Xeleon 1.2k Dec 28, 2022
Android ImageView that handles animated GIF images

GifImageView Android ImageView that handles Animated GIF images Usage In your build.gradle file: dependencies { compile 'com.felipecsl:gifimageview:

Felipe Lima 1.1k Mar 9, 2021
Android ImageView that supports different radii on each corner.

SelectableRoundedImageView Note that this project is no longer maintained. Android ImageView that supports different radii on each corner. It also sup

Joonho Kim 1.1k Mar 17, 2021
ImageView with a tag on android

SimpleTagImageView ImageView with a tag in android. So it's a ImageView. Demo ####Warning:When you set the round radius,the simpletagimageview scale t

null 944 Nov 10, 2022