PopupBubble


Source link: https://github.com/webianks/PopupBubble

PopupBubble

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

Min SDK

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

Add With Gradle Dependency

compile 'com.webianks.library:popup-bubble:1.0.5'

Maven:

<dependency>
<groupId>com.webianks.library</groupId>
<artifactId>popup-bubble</artifactId>
<version>1.0.5</version>
<type>pom</type> </dependency>

Add PopupBubble to layout

<com.webianks.library.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. By default it should be placed in top center. Also it should be placed below recyclerview in layout so that it shows on top of recyclerview.

Example positioning

If its inside RelativeLayout then

<com.webianks.library.PopupBubble
android:layout_margin="16dp"
android:id="@+id/popup_bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />

Customization Through XML

<!--Change background Color-->
  app:pb_backgroundColor="?attr/colorPrimary" <!--Change text -->
  app:pb_text="New Stories" <!--Change text color-->
  app:pb_textColor="#ffffff" <!--Show/Hide Icon inside the button. By default its true.-->
  app:pb_showIcon="false" <!--Change icon color-->
  app:pb_iconColor="#ffffff" <!--Set Different Icons-->
  app:pb_icon="@drawable/ic_new.png" <!--Set different fonts-->
  app:pb_font="iran_sans_mobile.ttf"

Example : Full Customization

<com.webianks.library.PopupBubble
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="16dp"
android:id="@+id/popup_bubble"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
app:pb_backgroundColor="?attr/colorPrimary"
app:pb_iconColor="#ffffff"
app:pb_text="New Stories"
app:pb_textColor="#ffffff"
app:pb_icon="@drawable/ic_keyboard_arrow_up_white_18dp"
app:pb_font="iran_sans_mobile.ttf" /> 

#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();

Control Animations Set false if you dont want any animations. Default value is true.

popupBubble.withAnimation(false);

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

popupBubble.updateText("10 new stories");

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

popupBubble.updateIcon(R.drawable.new_icon);

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

popupBubble.updateTypeFace(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).  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. 

Resources

Unofficial implementation of medium api for android.

A simple router lib to android.

Groupie helps you display and manage complex RecyclerView layouts.

@BindingAdapter for loading the images with Glide without writing a single line of code using Data Binding Library.

Avatar ImageView with user's name first letter Drawable placeholder.

An Annotation based validation library for use with Android's DataBinding library in an MVVM architecture.

  • Quick and easily add validation rules to ViewModels by annotating the class.
  • Annotation Processing to eliminate reflection and generate boilerplate validation classes.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes