All Projects → fennifith → Radiallayout

fennifith / Radiallayout

Licence: apache-2.0
A scrollable-ish view that arranges images in circles extending from the center of the screen.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Radiallayout

Guidetocustomviews
The ultimate guide to Android custom views
Stars: ✭ 595 (+3400%)
Mutual labels:  android-ui
Numberpicker
🎰 The android library that provides a simple and customizable NumberPicker.
Stars: ✭ 766 (+4405.88%)
Mutual labels:  android-ui
Animatedbottombar
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges.
Stars: ✭ 797 (+4588.24%)
Mutual labels:  android-ui
Materialdialog Android
📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Stars: ✭ 602 (+3441.18%)
Mutual labels:  android-ui
Music Player Go
🎶🎼 Very slim music player 👨‍🎤 100% made in Italy 🍕🌳🌞🍝🌄
Stars: ✭ 654 (+3747.06%)
Mutual labels:  android-ui
Insetter
Insetter is a library to help apps handle WindowInsets more easily
Stars: ✭ 766 (+4405.88%)
Mutual labels:  android-ui
Android Material Design For Pre Lollipop
Various UI implementations, animations & effects based on Material Design compatible with pre Lollipop devices as well. (Work in progess)
Stars: ✭ 585 (+3341.18%)
Mutual labels:  android-ui
Swipeablecard
A simple implementation of swipe card like StreetView
Stars: ✭ 812 (+4676.47%)
Mutual labels:  android-ui
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+4300%)
Mutual labels:  android-ui
Androidveil
🎭 An easy, flexible way to implement veil skeletons and shimmering effect for Android.
Stars: ✭ 792 (+4558.82%)
Mutual labels:  android-ui
Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+3535.29%)
Mutual labels:  android-ui
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+32447.06%)
Mutual labels:  android-ui
Labelsview
Android的标签列表控件。可以设置标签的选中效果。 可以设置标签的选中类型:不可选中、单选、限数量多选和不限数量多选等, 并支持设置必选项、单行显示、最大显示行数等功能。
Stars: ✭ 777 (+4470.59%)
Mutual labels:  android-ui
Bubble Scroll
An animating scroll bar
Stars: ✭ 598 (+3417.65%)
Mutual labels:  android-ui
Polygondrawingutil
A compact Android utility for constructing and drawing rounded regular polygons.
Stars: ✭ 805 (+4635.29%)
Mutual labels:  android-ui
Materialfavoritebutton
Animated favorite/star/like button
Stars: ✭ 586 (+3347.06%)
Mutual labels:  android-ui
Motiontoast
🌈 A Beautiful Motion Toast Library for Kotlin Android
Stars: ✭ 767 (+4411.76%)
Mutual labels:  android-ui
Recyclerviewinjectoradapter
RecyclerView.Adapter on steroids
Stars: ✭ 16 (-5.88%)
Mutual labels:  android-ui
Morphing Material Dialogs
Material dialog ❤️ morphing animation. An android kotlin UI library for building beautiful animations for converting a floating action button into a material dialog.
Stars: ✭ 806 (+4641.18%)
Mutual labels:  android-ui
Slidetoact
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
Stars: ✭ 783 (+4505.88%)
Mutual labels:  android-ui

RadialLayout is a scrollable-ish view that arranges images in circles extending from the center of the screen that was originally made for Lemonade. For demonstration and experimentation, an apk of the sample project can be downloaded here.

Screenshots

With Shadows Without Shadows GIF (pronounced "jeff")
img img img

Usage

Installation

The Gradle dependency is available through jCenter, which is used by default in Android Studio. To add the dependency to your project, copy this line into the dependencies section of your app's build.gradle file.

implementation 'me.jfenn:radiallayout:0.0.1'

Layout

You can add the view into any layout like this:

<me.jfenn.radiallayout.RadialLayoutView
    android:id="@+id/radialLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

There are not currently any XML attributes that can be used configure the view because of the way that this project is designed. Feel free to create an issue if there are any that you want. I can't think of any.

Items

There are three methods to modify the items of the view: setCenterItem, setItems, and updateItems.

Setting the Center Item

This method accepts a CenteredRadialItem. This class does not properly implement of the functionality of the BaseRadialItem subclass, and as such should not be passed to setItems or updateItems. It can be constructed and applied to the view as follows:

CenterItem item = new CenteredRadialItem(
    bitmap, // the image to display - will be resized to fit inside the item appropriately
    72      // the diameter of the center item, in dp
);

// (optional), draws an outline around the item
item.setOutline(
    3,          // the thickness (dp) of the outline
    4,          // the distance (dp) between the edge of the image and the outline
    Color.BLACK // the color of the outline
);

radialLayout.setCenterItem(item);

This method can be called at any time, and will not affect any of the functionality of the rest of the class.

Setting / Updating Radial Items

The setItems and updateItems methods set and update the items in the view, respectively. While setItems replaces the entire list of items with a new one, updateItems will attempt to "morph" the current list into a new one, and will try to preserve the radius and reuse bitmaps from items that are present in both lists. updateItems should only be called after setItems.

Both setItems and updateItems accept a list of BaseRadialItems and is intended to change the entire set of items to a new list. This list can contain classes other than RadialItem (for example, your own custom subclasses that draw their items differently), but it should not contain any CenteredRadialItem classes as stated above. RadialItems can be constructed as follows:

RadialItem item = new RadialItem(
    "item-5",   // The id of the item, used for comparisons when updateItems is called
    image,      // the image to display - will be resized to fit inside the item appropriately
    1,          // the size of the item, relative to other items in the view
    5           // the distance of the item from the center, relative to other items in the view
);

Both of the methods return a RadialLayoutView.Builder that allows you to specify certain parameters as follows:

radialLayout.setItems(items)
  .withItemRadius(36)           // the average radius of the views, in dp, +/- the variation (next line)
  .withItemRadiusVariation(6)   // how much (in dp) the radius of the views should vary according to the 'size' attribute of the items
  .withItemSeparation(8)        // the minimum distance between items in the view, in dp
  .withShadowRadius(4)          // the radius of the shadow to draw behind the view (dp)
  .withShadowOffset(2)          // the vertical offset of the shadow (dp)
  .apply();

The items in the view will not be applied instantly, as their positions are calculated in a background thread. To be notified when they are applied, you can pass a RadialLayout.Builder.OnAppliedListener to the apply() method, or call applySynchronous() in a background thread of your own.

Keep in mind that when a shadow radius and offset are specified, performance of the view will drop significantly for no apparent reason. I have not found a solution to this. See issue #1.

Configuration

Listening for Click Events

This is pretty straightforward.

radialLayout.setOnItemClickListener(new RadialLayoutView.OnItemClickListener() {
    @Override
    public void onItemClick(
            RadialLayoutView layout,    // the layout that the click event is from
            BaseRadialItem item,        // the item that was clicked
            int index                   // the index of the item that was clicked in the array
    ) {
        // do something
        
        // perhaps the easiest way to detect which item corresponds to what is by using the id argument
        // in the constructor for something other than making sure the lists are merged properly?
        
        // hint: item.getId();
    }
});

// and, for the center item...

radialLayout.setOnCenterClickListener(new RadialLayoutView.OnCenterClickListener() {
    @Override
    public void onCenterClick(RadialLayoutView layout /* the layout that the click event is from */) {
        // do something
    }
});

Paint

If for some reason you feel like it, there are also two methods in RadialLayoutView that return the paint used for shadows and images that you can use to modify... things.

Paint imagePaint = radialLayout.getPaint();
Paint shadowPaint = radialLayout.getShadowPaint();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].