Giter Site home page Giter Site logo

easyloading's Introduction

EasyLoading

Showing LoadingView or EmptyView easily for Activity and Fragment in Android.

Update: Now, you can allocate an Animation to view when showing or dismissing. There are two default animation for showing/dismissing,

if you just want to show a simple Animation,you can pass the @param(anim) null to the method, we will start the default Animation for view.

How to use

Activity

#####1.Show LoadingView in an Activity

ActivityLoading.showLoading(Activity activity, int layoutId)
ActivityLoading.showLoading(Activity activity, int layoutId, boolean dimBackground, boolean showAnimation, Animation anim)
ActivityLoading.showLoading(Activity activity, View view)
ActivityLoading.showLoading(Activity activity, View view, boolean dimBackground, boolean showAnimation, Animation anim)

#####2.Show EmptyView in an Activity

ActivityLoading.showEmpty(Activity activity, int layoutId)
ActivityLoading.showEmpty(Activity activity, View view)

#####3.dismiss LoadingView / EmptyView from Activity

ActivityLoading.dismiss(Activity activity)
ActivityLoading.dismiss(Activity activity, boolean showAnim, Animation anim)

Fragment

#####1.Show LoadingView in Fragment

FragmentLoading.showLoading(Fragment fragment, int layoutId)
FragmentLoading.showLoading(Fragment fragment, int layoutId, boolean dimBackground, boolean showAnimation, Animation anim)
FragmentLoading.showLoading(Fragment fragment, View view)
FragmentLoading.showLoading(Fragment fragment, View view, boolean dimBackground, boolean showAnimation, Animation anim)

#####2.Show EmptyView in Fragment

FragmentLoading.showEmpty(Fragment fragment, int layoutId)
FragmentLoading.showEmpty(Fragment fragment, View view)

#####3.dismiss LoadingView / EmptyView from Fragment

FragmentLoading.dismiss(Fragment fragment)
FragmentLoading.dismiss(Fragment fragment, boolean showAnim, Animation anim)

####Notice To showing LoadingView or EmptyView in a Fragment, the Fragment’s rootView must be a FrameLayout or FrameLayout’s subclass, there're two ways to do it.
<1>.Define a xml-layout which rootView is FrameLayout for the Fragment.
<2>.Make your Fragment extends LoadingSupportFragment and achieve the method contentViewLayoutId() to return your xml-layout's Id, and you don’t need to override the method onCreateView(); Now, you can show the EmptyView or LoadingView simply;

为了让Fragment能够显示LoadingView或EmptyView,Fragment所创建的view必须是FrameLayout或者FrameLayout的子类,这里有两种快捷的方法.
<1>.定义一个layout布局文件然后让Fragment创建view,但该layout的rootView必须为FrameLayout;
<2>.继承LoadingFragment或者LoadingSupportFragment,并且实现方法contentViewLayoutId(),在该方法中返回自定义的layout布局文件,该布局文件则没有rootView的限制,rootView可以是任意的控件,并且,使用这种方法也就不需要再重写Fragment的onCreateView方法;

###ScreenShot http://img.my.csdn.net/uploads/201601/07/1452128584_2972.gif

easyloading's People

Contributors

a284628487 avatar

Watchers

 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.