Coder Social home page Coder Social logo

filtermenu's Introduction

FilterMenu

Maven Central

This is a library project with a custom view that implements concept of Filter Menu(https://dribbble.com/shots/1956586-Filter-Menu) made by Anton Aheichanka for android

Quick Overview

  • Download sample Apk

  • Screenshots

    screenshot
  • Youtube Video

    Youtube Video

Futures

  • Detect edge automatically
  • Support for android menu resource

Getting Started

  • Download the source to use it as library project, or grab via Maven
<dependency>
  <groupId>com.linroid.filtermenu</groupId>
  <artifactId>library</artifactId>
  <version>{last-version}</version>
  <type>aar</type>
</dependency>

or Gradle

compile 'com.linroid.filtermenu:library:0.2.+@aar'
  • Declare FilterMenuLayout inside your layout

    <com.linroid.filtermenu.library.FilterMenuLayout
        android:id="@+id/filter_menu"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:elevation="8dp"
        custom:fm_expandedRadius="96dp"
        custom:fm_collapsedRadius="24dp"
        custom:fm_centerBottom="50dp"
        custom:fm_centerRight="50dp"
        custom:fm_primaryColor="#ff37aa4a"
        custom:fm_primaryDarkColor="#ff20622b">
    </com.linroid.filtermenu.library.FilterMenuLayout>
    
    
    <!--circle radius size when menu expanded-->
    custom:fm_expandedRadius
    <!--circle radius size when menu collapsed-->
    custom:fm_collapsedRadius
    <!--set the position of circle, the menu will auto align.
        You should only set two directions at most.-->
    custom:fm_center[Left|Top|Right|Bottom]
    <!-- If true, centers the circle horizontally.-->
    custom:fm_centerHorizontal
    <!-- If true, centers the circle vertically.-->
    custom:fm_centerVertical
    <!--primary color-->
    custom:fm_primaryColor
    <!--color of inner circle when menu expanded-->
    custom:fm_primaryDarkColor
  • Initial menu items via java code

    FilterMenuLayout layout = (FilterMenuLayout) findViewById(R.id.filter_menu);
    FilterMenu menu = new FilterMenu.Builder(this)
        .addItem(R.drawable....)
        //.inflate(R.menu....)//inflate  menu resource
        .attach(layout)
        .withListener(new FilterMenu.OnMenuChangeListener() {
            @Override
            public void onMenuItemClick(View view, int position) {
            }
            @Override
            public void onMenuCollapse() {
            }
            @Override
            public void onMenuExpand() {
            }
        })
        .build();

ChangeLog

  • 0.2.0
    • support for android menu resource
    • support for centerHorizontal and centerVertical attribute

License

Copyright 2015 linroid

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.

filtermenu's People

Contributors

alorma avatar linroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filtermenu's Issues

The aar on jcenter may has some problem.

When i use the aar on jcenter, something was wrong.
If i use the aar made by the master project, it can be OK.
So i wonder the aar on jcenter may has some problem.

无法使用attr定义的样式,设置后造成FC。

无法使用样式中定义的attr属性。设置后会造成FC。

    app:primaryColor="?attr/colorPrimary"
    app:primaryDarkColor="?attr/colorPrimaryDark"

解决方案如下:修改FilterMenuLayout 的 init(ctx,attrs)第二行

    TypedArray ta = ctx.getResources().obtainAttributes(attrs, R.styleable.FilterMenuLayout);

    TypedArray ta = ctx.obtainStyledAttributes(attrs, R.styleable.FilterMenuLayout);

Icon size

Hi, great library!
Is there a way to control the size of the icons?

adding 4 menu in layout in different directions

By default when we add four menu in layout then they align in
northeast (NE), southeast (SE), southwest (SW), and northwest (NW).
but i want to rotate them by 45 Degrees i,e
they should align in
North, South, East, West
something like this.
jkwr5

What changes should be done so that i can use this library.

Impossible to build

\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.3\res\values\values.xml
Error:(2) Attribute "primaryColor" has already been defined
Error:Execution failed for task ':app:processDebugResources'.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files (x86)\Android\android-sdk\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1

It seems that you do not have to use attribut name primaryColor in attrs.xml

在小米2中会闪退

系统版本 MIUI 5,基于Android 4.4.4

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.bitnp.netcheckin2/org.bitnp.netcheckin2.ui.MainActivity}: android.os.BadParcelableException: ClassNotFoundException when unmarshalling:
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2207)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2256)
at android.app.ActivityThread.access$800(ActivityThread.java:147)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5133)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:808)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.os.BadParcelableException: ClassNotFoundException when unmarshalling:
at android.os.Parcel.readParcelableCreator(Parcel.java:2154)
at android.os.Parcel.readParcelable(Parcel.java:2104)
at android.view.AbsSavedState.(AbsSavedState.java:57)
at android.view.View$BaseSavedState.(View.java:18684)
at com.linroid.filtermenu.library.FilterMenuLayout$SavedState.(FilterMenuLayout.java:841)
at com.linroid.filtermenu.library.FilterMenuLayout$SavedState.(FilterMenuLayout.java:812)
at com.linroid.filtermenu.library.FilterMenuLayout$SavedState$1.createFromParcel(FilterMenuLayout.java:852)
at com.linroid.filtermenu.library.FilterMenuLayout$SavedState$1.createFromParcel(FilterMenuLayout.java:850)
at android.os.Parcel.readParcelable(Parcel.java:2111)
at android.os.Parcel.readValue(Parcel.java:2020)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2382)
at android.os.Parcel.readSparseArray(Parcel.java:1742)
at android.os.Parcel.readValue(Parcel.java:2077)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2321)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1273)
at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1748)
at android.app.Activity.onRestoreInstanceState(Activity.java:970)
at android.app.Activity.performRestoreInstanceState(Activity.java:942)
at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1138)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
... 11 more

暂时只有在小米2和2A的旧系MIUI中发现了这个问题。

Crash

11-19 19:05:05.502 11148-11148/com.yoavst.mashov.debug E/Parcel: Class not found when unmarshalling:
                                                                 java.lang.ClassNotFoundException: Invalid name:
                                                                     at java.lang.Class.classForName(Native Method)
                                                                     at java.lang.Class.forName(Class.java:309)
                                                                     at java.lang.Class.forName(Class.java:273)
                                                                     at android.os.Parcel.readParcelableCreator(Parcel.java:2281)
                                                                     at android.os.Parcel.readParcelable(Parcel.java:2245)
                                                                     at android.view.AbsSavedState.<init>(AbsSavedState.java:57)
                                                                     at android.view.View$BaseSavedState.<init>(View.java:20270)
                                                                     at com.linroid.filtermenu.library.FilterMenuLayout$SavedState.<init>(FilterMenuLayout.java:853)
                                                                     at com.linroid.filtermenu.library.FilterMenuLayout$SavedState.<init>(FilterMenuLayout.java:830)
                                                                     at com.linroid.filtermenu.library.FilterMenuLayout$SavedState$1.createFromParcel(FilterMenuLayout.java:834)
                                                                     at com.linroid.filtermenu.library.FilterMenuLayout$SavedState$1.createFromParcel(FilterMenuLayout.java:832)
                                                                     at android.os.Parcel.readParcelable(Parcel.java:2252)
                                                                     at android.os.Parcel.readValue(Parcel.java:2152)
                                                                     at android.os.Parcel.readSparseArrayInternal(Parcel.java:2546)
                                                                     at android.os.Parcel.readSparseArray(Parcel.java:1874)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.