Implementing the LoadingFragment is just like a regular fragment. Management of the progress bar is done completely behind the scenes as your View is programatically injected into the structured view hierarchy.
LoadingFragment has three abstract methods:
public abstract View onCreateMainView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);
public abstract void configureAnimator(ViewAnimator viewAnimator);
public abstract void configureProgressBackground(ImageView mProgressBBackground);
onCreateMainView is identical to onCreateView of a standard fragment. The other two methods provide access to the indeterminate progress bar background, and the managing ViewAnimator.
There are two public methods:
showContent()
showLoading()
The starting screen is the progress bar, after your content is done loading simply call showContent(). If you need to reload your view's data, call showLoading() first if desired.
Copyright 2012 Noah Seidman
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.