Skip to content

manuelgon47/android-pop-korn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Pop Corn Menu

A popcorn menu for android

Installation

Requeriments: - minSdkVersion 21 - App style with NoActionBar

Steps to install the module:

  • In terminal go to: $YourAndroidWorkspace/AppName/yourappmodule/libs
  • Make git clone from this repo inside libs folder
  • Import the android library

- In your app build.gradle: ``` dependencies { compile project(":popcornmenu") } ```

How to use

In your xml activity add: ``` ```

Just with that you will get the pop corn menu working without buttons.

How to custom

Add menu entries
``` PopCornMenu menu = (PopCornMenu)findViewById(R.id.popmenu); if (menu != null) { int[] buttons = new int[]{R.drawable.drawableButton1, R.drawable.drawableButton2, R.drawable.drawableButton3, R.drawable.drawableButton4}; menu.setup(buttons); } ```
Set buttons listener
You receive an index that correspond with the position in which you put the button. ``` menu.setListener(new PopCornMenuListener() { @Override public void onPopCornMenuClicked(int index) { switch (index) { case 0: Toast.makeText(MainActivity.this, "Tap on drawableButton1", Toast.LENGTH_SHORT).show(); break; case 1: Toast.makeText(MainActivity.this, "Tap on drawableButton2", Toast.LENGTH_SHORT).show(); break; case 2: Toast.makeText(MainActivity.this, "Tap on drawableButton3", Toast.LENGTH_SHORT).show(); break; case 3: Toast.makeText(MainActivity.this, "Tap on drawableButton4", Toast.LENGTH_SHORT).show(); break; } } }); ```
Custom display animation duration
You can change the duration in which the pop corn menu displays ``` menu.setAnimationDuration(250L); ```
Custom menu button background
You have 3 options:
- Using an hex value (0x AA: Alpha; HHHHHH: Hex color) ``` menu.changeMenuColor(0xffE342B3); ``` - Using the class android.graphics.Color ``` menu.changeMenuColor(Color.RED); ``` - Using your values from your xml colours file ``` menu.changeMenuColor(getResources().getColor(R.color.your_colour_resource)); ```
# License ``` Copyright (C) 2015 Manuel González Villegas

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.

About

A popcorn menu for android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages