GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - sirencode/Android-ProgressSwitcher: Set of tools with the ability to display indeterminate progress indicator when you are waiting for the initial data.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

51 Commits
51 Commits

Folders and files

NameName
Last commit message
Last commit date
library
library
 
 
sample
sample
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE.txt
LICENSE.txt
 
 
ProgressSwitcher-Sample.apk
ProgressSwitcher-Sample.apk
 
 
ProgressSwitcher.aar
ProgressSwitcher.aar
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
maven_push.gradle
maven_push.gradle
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

Android-ProgressSwitcher

The library is used to switch between content, progress, empty or error views. The main The progress is displayed during initial data loading. If data is empty then empty view is displayed. The same goes for error view. The work was based on Android-ProgressFragment project, but with a more declarative setup and state persistence.

Sample apk

Dependencies

AAR

The project now in Maven Central, so you can add dependency

dependencies {
    compile 'com.github.drnkn:progress-switcher:1.1.3@aar'
}

Compatibility

This library is compatible from API 4 (Android 1.6).

Sample

A sample can be found on Google Play:

Get it on Google Play

Usage

The library consist of three main classes: ProgressWidget, ProgressSwitcher and ProgressFragment. All classes implement Switcher interface. The most important methods are:

For changing state:

public void showContent()
public void showProgress()
public void showEmpty()
public void showError()

For configure switcher:

public void setEmptyText(int resId)
public void setErrorText(int resId)
public void setOnEmptyViewClickListener(OnClickListener onClickListener, int viewId)
public void setOnErrorViewClickListener(OnClickListener onClickListener, int viewId)
  • ProgressWidget

Declare widget in layout:

<ru.vang.progressswitcher.ProgressWidget xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:progress="http://schemas.android.com/apk/res-auto"
    android:id="@+id/progress_widget"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    progress:emptyViewLayout="@layout/custom_empty_view"
    progress:errorViewLayout="@layout/custom_error_view"
    progress:progressViewLayout="@layout/custom_progress_view"
    progress:animationIn="@anim/zoom_in"
    progress:animationOut="@anim/zoom_out">

    <include layout="@layout/view_content" />

</ru.vang.progressswitcher.ProgressWidget>

... and that's it. Now you can get widget in your fragment and do what yout want.

  • ProgressSwitcher

One way of using ProgressSwitcher is setup it with content view. Inflate your content view:

    @Override
    public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
            final Bundle savedInstanceState) {
        mContentView = inflater.inflate(R.layout.view_content, container, false);

        return mContentView;
    }

Setup switcher with fromContentView method:

    @Override
    public void onActivityCreated(final Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mProgressSwitcher = ProgressSwitcher
                .fromContentView(getActivity(), mContentView);
    }

The second way is provide complete layout:

<FrameLayout
      android:layout_width="match_parent"
	  android:layout_height="match_parent"
      android:id="@id/content_container">
     
      <include
      android:id="@id/progress_view"
      layout="@layout/progress_view" />
     
      <include
      android:id="@id/empty_view"
      layout="@layout/empty_view" />
     
      <include
      android:id="@id/error_view"
      layout="@layout/error_view" />
     
</FrameLayout>

And setup switcher with fromRootView method and add content view:

    @Override
    public void onActivityCreated(final Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        mProgressSwitcher = ProgressSwitcher
                .fromRootView(getActivity(), mContentView);
        mProgressSwitcher.addContentView(R.layout.view_content)
    }
  • ProgressFragment

Extend ProgressFragment:

public class CustomProgressFragment extends ProgressFragment {
}

Setup content view:

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
 
    setContentView(R.layout.view_content);
}

Developed By

  • Dmitry Zaitsev - [email protected]

License

Copyright 2014 Dmitry Zaitsev

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.

About

Set of tools with the ability to display indeterminate progress indicator when you are waiting for the initial data.

github.com/Drnkn/Android-ProgressSwitcher

Resources

Readme
Apache-2.0 license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.