Git Product home page Git Product logo

popupbubble's Introduction

Releases License

PopupBubble

Easily Add "New Post" popup button with the feeds (recyclerview) of your app.

screenshot

Min SDK

Minimum sdk is 19 and support is limited to recyclerview for now.

Add With Gradle Dependency

compile 'com.github.nextcloud:PopupBubble:2.0.0'

Add PopupBubble to layout

<com.nextcloud.ui.popupbubble.PopupBubble
  android:id="@+id/popup_bubble"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
/>

Positioning of this view can be done according to the need and is based on MaterialButtonso all themeing/customization is applicable.

Access the bubble from Java

PopupBubble popupBubble = (PopupBubble) findViewById(R.id.popup_bubble);

Add listener if you want to know when the bubble is clicked

popupBubble.setPopupBubbleListener(new PopupBubble.PopupBubbleClickListener() {
            @Override
            public void bubbleClicked(Context context) {
  
                //popup_bubble is clicked  
            }
        });

Attach with your RecyclerView

 //necessary to add
popupBubble.setRecyclerView(recyclerView);

#Helper Methods

Hide/Show PopupBubble according to your need

popupBubble.hide();
popupBubble.show();

Update text dynamically Call this method before the activate method to set the new text.

popupBubble.setText("10 new stories");

Update icon dynamically Call this method before the activate method to set the new Icon.

popupBubble.setIcon(R.drawable.new_icon);

Update typeface of text dynamically Call this method before the activate method to set the new Typeface.

popupBubble.setTypeFace(myCustomTypeface);

Most Important

Now download/fetch new content in background and then notify your recyclerview adapter about range of items added and finally activate the PopupBubble to make it appear with animation (if not set false).

//Own logic for fetching new content
 .....      
adapter.notifyItemRangeInserted(0,size_of_new_items_added); // size_of_new_items_added = 10 if 10 new items are added.
popupBubble.activate(); 

License

PopupBubble library for Android
Copyright (c) 2016 Ramankit Singh (http://github.com/webianks).
Copyright (c) 2022 Andy Scherzinger

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.

popupbubble's People

Contributors

andyscherzinger avatar dependabot[bot] avatar needsst avatar omidheshmatinia avatar rayliverified avatar skjnldsv avatar webianks avatar

Watchers

 avatar  avatar

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.