FlycoBanner-Master


Source link: https://github.com/H07000223/FlycoBanner_Master

#FlycoBanner-Master

???

An android view looper library. Support for Android 2.2 and up.

##Demo

#### Here is a DemoApk download

##Gradle

dependencies{

  compile 'com.android.support:support-v4:22.2.1'
  compile 'com.nineoldandroids:library:2.4.0'
  compile 'com.flyco.banner:FlycoBanner_Lib:2.0.2@aar' 
}

##Usage

###Extends BaseIndicatorBanner and Set Data Type

public class SimpleImageBanner extends BaseIndicatorBanner<BannerItem, SimpleImageBanner> {

  private ColorDrawable colorDrawable;

public SimpleImageBanner(Context context) {

this(context, null, 0);

  
}

public SimpleImageBanner(Context context, AttributeSet attrs) {

this(context, attrs, 0);

  
}

public SimpleImageBanner(Context context, AttributeSet attrs, int defStyle) {

super(context, attrs, defStyle);

colorDrawable = new ColorDrawable(Color.parseColor("#555555"));

  
}

@Override
  public void onTitleSlect(TextView tv, int position) {

final BannerItem item = list.get(position);

tv.setText(item.title);

  
}

@Override
  public View onCreateItemView(int position) {

View inflate = View.inflate(context, R.layout.adapter_simple_image, null);

ImageView iv = ViewFindUtils.find(inflate, R.id.iv);

 final BannerItem item = list.get(position);

int itemWidth = dm.widthPixels;

int itemHeight = (int) (itemWidth * 360 * 1.0f / 640);

iv.setScaleType(ImageView.ScaleType.CENTER_CROP);

iv.setLayoutParams(new LinearLayout.LayoutParams(itemWidth, itemHeight));

 String imgUrl = item.imgUrl;

 if (!TextUtils.isEmpty(imgUrl)) {

 Glide.with(context)

.load(imgUrl)

.override(itemWidth, itemHeight)

.centerCrop()

.placeholder(colorDrawable)

.into(iv);

}
 else {

 iv.setImageDrawable(colorDrawable);

}

 return inflate;
  
}
 
}

###The Most Complex in layout xml

<com.flyco.bannersamples.banner.SimpleImageBanner

android:id="@+id/sib_the_most_comlex_usage"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

banner:bb_barColor="#88000000"

banner:bb_barPaddingBottom="5dp"

banner:bb_barPaddingLeft="10dp"

banner:bb_barPaddingRight="10dp"

banner:bb_barPaddingTop="5dp"

banner:bb_delay="2"

banner:bb_indicatorGravity="RIGHT"

banner:bb_isAutoScrollEnable="true"

banner:bb_isBarShowWhenLast="true"

banner:bb_isIndicatorShow="true"

banner:bb_isLoopEnable="true"

banner:bb_isTitleShow="true"

banner:bb_period="10"

banner:bb_scale="0.5625"

banner:bb_textColor="#ffffff"

banner:bb_textSize="13.5sp"

banner:bb_indicatorCornerRadius="3dp"

banner:bb_indicatorGap="8dp"

banner:bb_indicatorHeight="6dp"

banner:bb_indicatorSelectColor="#ffffff"

banner:bb_indicatorStyle="CORNER_RECTANGLE"

banner:bb_indicatorUnselectColor="#88ffffff"

banner:bb_indicatorWidth="6dp"/>

int Java Code

sib
  .setSelectAnimClass(ZoomInEnter.class)

  //set indicator select anim
  .setSource(DataProvider.getList())

//data source list
  .setTransformerClass(ZoomOutSlideTransformer.class) //set page transformer
  .startScroll();

###The Simplest in layout xml

<com.flyco.bannersamples.banner.SimpleImageBanner

  android:id="@+id/sib_simple_usage"

  android:layout_width="fill_parent"

  android:layout_height="wrap_content"

  banner:bb_scale="0.5625"/>

int Java Code

sib
 .setSource(DataProvider.getList())
 .startScroll();

###Attributes

name format description
bb_scale float scale of Banner height and width,height/screenWidth
bb_isLoopEnable boolean is LoopViewPager or not,default true
bb_delay integer delay before start scroll,unit second,default 5 seconds
bb_period integer scroll period,unit second,default 5 seconds
bb_isAutoScrollEnable boolean is auto scroll enable,default true
bb_barColor color set bootom bar color,default transparent
bb_isBarShowWhenLast boolean set bottom bar show or not when the position is the last
bb_barPaddingLeft dimension set bottom bar padding,unit dp
bb_barPaddingTop dimension set bottom bar padding,unit dp
bb_barPaddingRight dimension set bottom bar padding,unit dp
bb_barPaddingBottom dimension set bottom bar padding,unit dp
bb_textColor color set title text color,default "#ffffff"
bb_textSize dimension set title text size,unit sp,default 14sp
bb_isTitleShow boolean set title show or not,default true
bb_isIndicatorShow boolean set indicator show or not,default true
bb_indicatorGravity enum Gravity.CENTER or RIGHT or LEFT.if gravity equals CENTER,title will not be supported,default CENTER
bb_indicatorStyle enum indicator style, STYLE_DRAWABLE_RESOURCE or STYLE_CORNER_RECTANGLE
bb_indicatorWidth dimension indicator width, unit dp, default 6dp
bb_indicatorHeight dimension indicator height,unit dp,default 6dp
bb_indicatorGap dimension gap between two indicators,unit dp,default 6dp
bb_indicatorSelectColor color indicator select color for STYLE_CORNER_RECTANGLE, default "#ffffff"
bb_indicatorUnselectColor color indicator unselect color for STYLE_CORNER_RECTANGLE, default "#88ffffff"
bb_indicatorCornerRadius dimension indicator corner raduis for STYLE_CORNER_RECTANGLE,unit dp, default 3dp
bb_indicatorSelectRes reference indicator select drawable resource for STYLE_DRAWABLE_RESOURCE
bb_indicatorUnselectRes reference indicator unselect drawable resource for STYLE_DRAWABLE_RESOURCE

##Thanks

Resources

Prevent screen from turning off until your user is looking at the screen.

Monotweety is a simple Twitter Client just for tweeting from notification area.

It demonstrates reactive mvvm-like architecture and Conductor, an framework that allows building View-based Android applications.

Use one line to apply almost famous libraries of proguard configurations.

RxDownloader is an RxWrapped Download Manager.

Simple JUnit rule for overriding RxJava/RxAndroid schedulers during unit tests.

A MultiScreen-Support-Library for Android.

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