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

Overview

Android-ProgressFragment

Android Arsenal

Implementation of the fragment with the ability to display indeterminate progress indicator when you are waiting for the initial data. Based on ListFragment.

Sample

A sample application is available on Google Play:

Get it on Google Play

screenshot

Compatibility

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

Usage

To display the progress fragment you need the following code:

  • Create your implementation of progress fragment
public class MyProgressFragment extends ProgressFragment {
	// your code of fragment
}

or if you use ActionBarSherlock

public class MyProgressFragment extends SherlockProgressFragment {
	// your code of fragment
}
  • Setup content view and empty text (optional) in onActivityCreate() method.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    // Setup content view
    setContentView(R.layout.content);
    // Setup text for empty content
    setEmptyText(R.string.empty);
    // ...
}
  • Display of indeterminate progress indicator
setContentShown(false);
  • When the data is loaded to set whether the content is empty and show content
setContentEmpty(/* true if content is empty else false */);
setContentShown(true);

Gradle

Android-ProgressFragment library is now pushed to Maven Central as a AAR, so you just need to add the following dependency to your build.gradle.

ProgressFragment (support-v4):

dependencies {
    compile 'com.github.johnkil.android-progressfragment:progressfragment:1.4.+'
}

ProgressFragment (native):

dependencies {
    compile 'com.github.johnkil.android-progressfragment:progressfragment-native:1.4.+'
}

SherlockProgressFragment:

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
    compile('com.github.johnkil.android-progressfragment:sherlockprogressfragment:1.4.+') {
        exclude module: 'support-v4'
    }
}

Example Gradle project using Android-ProgressFragment:

Developed By

License

Copyright 2013 Evgeny Shishkin

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.
Comments
  • java.lang.RuntimeException: Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'

    java.lang.RuntimeException: Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'

    Dear johnkil, firstly compliments for great work. I'm try to use your library (SherlockProgressFragment). I've follow your guide, but when i click for show fragment i've the error as issue title:

    java.lang.RuntimeException: Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'

    I've include your fragment_custom_progress into my layout...where are my errors?

    Thanks and Best Regards

    opened by mitsus 3
  • java.lang.IllegalStateException

    java.lang.IllegalStateException

    java.lang.IllegalStateException: Content view not yet created at com.devspark.progressfragment.ProgressFragment.ensureContent(ProgressFragment.java:270) at com.devspark.progressfragment.ProgressFragment.setContentShown(ProgressFragment.java:200) at com.devspark.progressfragment.ProgressFragment.setContentShown(ProgressFragment.java:174) at com.devspark.progressfragment.sample.DefaultProgressFragment$1.run(DefaultProgressFragment.java:36) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5041) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) at dalvik.system.NativeStart.main(Native Method)

    waffle:ready 
    opened by johnkil 3
  • Failed build for minSdkVersion=4

    Failed build for minSdkVersion=4

    Thank you for this useful library.

    But I have faced the issue when I try to build your sample application. It is impossible to build sample application with minSdkVersion set to "4". Could you please change sample application code to met Android-ProgressFragment library requirements (I mean minSdkVersion="4")? Thank you.

    opened by AShuba 2
  • listview isn't showing with ProgressFragment

    listview isn't showing with ProgressFragment

    Hey, firstly nice work with the fragment! It is really helpful.

    However, I want to ask why is my listview not showing up when extending ProgressFragment? I can't use a ListFragment as I have 2 listviews in that view, and it's rather a customised fragment..

    opened by winsonlim 1
  • Obtain data process restarted on configuration changed

    Obtain data process restarted on configuration changed

    Obtain data process restarted on any configuration changed event, for example on device rotation. Looks like this issue is very serious. It may prevent to use this library for Activities which starting time depends on network requests.

    opened by AShuba 1
  • java.lang.NullPointerException on  mHandler.removeCallbacks(mShowContentRunnable);

    java.lang.NullPointerException on mHandler.removeCallbacks(mShowContentRunnable);

    I have an issue when i'm moving from the portrait mode to landscape mode on mHandler.removeCallbacks(mShowContentRunnable); the onDestroyView is under a class that extends ProgressFragment How i can fix it?

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mHandler.removeCallbacks(mShowContentRunnable);
    }
    

    Here my error log 02-27 20:30:44.474: E/AndroidRuntime(19930): FATAL EXCEPTION: main 02-27 20:30:44.474: E/AndroidRuntime(19930): Process: com.georgiospanayi.cyprusshots, PID: 19930 02-27 20:30:44.474: E/AndroidRuntime(19930): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.georgiospanayi.cyprusshots/com.georgiospanayi.cyprusshots.HomeActivity}: java.lang.NullPointerException 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3738) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.access$900(ActivityThread.java:135) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.os.Handler.dispatchMessage(Handler.java:102) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.os.Looper.loop(Looper.java:136) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.main(ActivityThread.java:5017) 02-27 20:30:44.474: E/AndroidRuntime(19930): at java.lang.reflect.Method.invokeNative(Native Method) 02-27 20:30:44.474: E/AndroidRuntime(19930): at java.lang.reflect.Method.invoke(Method.java:515) 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 02-27 20:30:44.474: E/AndroidRuntime(19930): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:126) 02-27 20:30:44.474: E/AndroidRuntime(19930): at dalvik.system.NativeStart.main(Native Method) 02-27 20:30:44.474: E/AndroidRuntime(19930): Caused by: java.lang.NullPointerException 02-27 20:30:44.474: E/AndroidRuntime(19930): at com.georgiospanayi.fragments.PlaceholderFragment.onDestroyView(PlaceholderFragment.java:177) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.Fragment.performDestroyView(Fragment.java:1705) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:996) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1201) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:639) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.Activity.performStart(Activity.java:5241) 02-27 20:30:44.474: E/AndroidRuntime(19930): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168) 02-27 20:30:44.474: E/AndroidRuntime(19930): ... 13 more

    opened by giwrgos88 0
  • How to close the NavigationDrawerFragment on startup?

    How to close the NavigationDrawerFragment on startup?

    Hello first i will like to say that you have don a great job. second ii'm having an issue with the library. i have added it in my fragment but every time that i start the app it shows the mNavigationDrawerFragment open. how i can close it when the app it loads? thank you

    opened by giwrgos88 0
  • waffle.io Badge

    waffle.io Badge

    Merge this to receive a badge indicating the number of issues in the ready column on your waffle.io board at http://waffle.io/johnkil/Android-ProgressFragment

    This was requested by a real person on waffle.io, we're not trying to spam you.

    opened by waffleio 0
  • java.lang.NullPointerException

    java.lang.NullPointerException

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.devspark.progressfragment.sample/com.devspark.progressfragment.sample.ProgressActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1751) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1767) at android.app.ActivityThread.access$1500(ActivityThread.java:122) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1005) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:132) at android.app.ActivityThread.main(ActivityThread.java:4028) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:491) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.devspark.progressfragment.sample.ProgressActivity$ActionBarHelper.setDisplayHomeAsUpEnabled(ProgressActivity.java:96) at com.devspark.progressfragment.sample.ProgressActivity$ActionBarHelper.access$1(ProgressActivity.java:95) at com.devspark.progressfragment.sample.ProgressActivity.onCreate(ProgressActivity.java:42) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1715) ... 11 more

    waffle:done 
    opened by johnkil 0
  • About the frameLayout

    About the frameLayout

    Why do you use the FrameLayout to contain the ImageView like this:

     <FrameLayout
            android:id="@+id/content_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    
            <TextView
                    android:id="@android:id/empty"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:gravity="center"
                    android:textAppearance="?android:attr/textAppearanceLarge"/>
    </FrameLayout>
    

    Is it necessary? Can I remove the FrameLayout ?

    opened by mBigFlower 0
  • Tons of ProgressFragment.ensureContent errors

    Tons of ProgressFragment.ensureContent errors

    Sometimes i get tons of error feedbacks from my users about the lib.

    java.lang.IllegalStateException: Content view not yet created at com.devspark.progressfragment.ProgressFragment.ensureContent(ProgressFragment.java:273) at com.devspark.progressfragment.ProgressFragment.setContentEmpty(ProgressFragment.java:250)

    My fragments like; public class BusListFragment extends ProgressFragment { private Context context; private CardRecyclerView cardRecyclerView; private View rootView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setHasOptionsMenu(true);
        setRetainInstance(true);
    }
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_mycards, container, false);
        context = getActivity();
        cardRecyclerView = (CardRecyclerView) rootView.findViewById(R.id.cardRecyclerView);
        return super.onCreateView(inflater, container, savedInstanceState);
    }
    
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        setContentView(rootView);
        if (stopId != null && location != null) {
            new getClosestBusListAsync(this).execute();
        }
    }
    

    } and the task is like; public class getClosestStopListAsync extends AsyncTask<Void, Void, String> { ProgressFragment fragment; Context context; GoogleMap map; LatLng location;

    public getClosestStopListAsync(ProgressFragment fragment, LatLng location, GoogleMap map) {
        this.fragment = fragment;
        this.context = fragment.getActivity();
        this.location = location;
        this.map = map;
    }
    
    @Override
    protected String doInBackground(Void... args0) {
        return new RequestHelper().getClosestStopList(PreferenceHelper.getCity(context), location.latitude, location.longitude);
    }
    
    @Override
    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        if (result != null) {
            map.clear();
    
            BusStop stopList = JsonHelper.getClosestStopList(result);
            if (stopList != null) {
                if (stopList.getResult().getCode().equals("0")) {
                    if (stopList != null || stopList.getBusStopList().size() > 0) {
                        for (BusStop.BusStopItem busStop : stopList.getBusStopList()) {
                            map.addMarker(new MarkerOptions()
                                    .position(new LatLng(Double.parseDouble(busStop.getLatitude()), Double.parseDouble(busStop.getLongitude())))
                                    .title(busStop.getStopId() + " - " + busStop.getStopName() + " - " + busStop.getType())
                                    .snippet(busStop.getRoutes())
                                    .icon(BitmapDescriptorFactory.fromResource(R.drawable.stop)));
                        }
                        fragment.setContentEmpty(false);
                    } else {
                        fragment.setContentEmpty(true);
                        fragment.setEmptyText(R.string.empty_list);
                    }
                }
            }
            System.gc();
            fragment.setContentShown(true);
        }
    }
    

    }

    how can it be possible that content view not yet created? OnActivityCreated is called after OnCreateView so that means views could be created?

    How can i fix this issue? Thanks.

    opened by Swisyn 3
  • Ability to not use setContentView

    Ability to not use setContentView

    Since I was using this library, I was not happy with the setContentView method. It is because it is not similar to the methods you would use when you normalle use Fragments.

    When I use ProgressListFragment it is like magic. Even when I use custom layout in the onCreateView it gets the ListView and does all the magic automatically.

    Here is the solution in my mind. I hope I can tell it well. If you have a FrameLayout in the content_container FrameLayout on top of the emptyView. You can use that id as a mContentView. When developer use custom layout in onCreateView and have a view with that id, you can use it right away. If the developer don't have a view with that id, you can expect usage of setContentView. If the developer doesn't do any of that, you can throw a IllegalStateException.

    What do you think? Sorry if the English is not good.

    opened by tasomaniac 4
  • Support for DialogFragments

    Support for DialogFragments

    It would be great to have base classes who's parents were either DialogFragment or SherlockDialogFragment

    It shouldn't require any real changes to how things work.

    opened by Wavesonics 1
Releases(1.4.0)
Owner
Evgeny Shishkin
Senior Android Developer
Evgeny Shishkin
This project created just for help developer who want to and ability of read VISA, UNION PAY, HUMO, ATTO and some other cards data read.

If you enjoy my content, please consider supporting what I do. Thank you. By me a Coffee To get a Git project into your build: Step 1. Add the JitPack

Fozilbek Imomov 1 Oct 15, 2022
Android-ScrollBarPanel allows to attach a View to a scroll indicator like it's done in Path 2.0

Path 2.0 like ScrollBarPanel for Android Android-ScrollBarPanel allows to attach a View to a scroll indicator like it's done in Path 2.0. Features Sup

Arnaud Vallat 551 Dec 22, 2022
Step indicator with titles/labels and tons of customizations.

PageStepIndicator was built from existing StepIndicator library developed by Layerlre . I needed a page indicator that can display title and at the sa

OGx09 27 Apr 17, 2022
Scrollbar Indicator usign compose

Carousel Carousel is a scroll indicator for ScrollableState composes. Carousel can be vertial or horizontal indicator based on the size provided using

null 58 Oct 19, 2022
MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

About MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files (local/remote) as formatted HTML, and st

Feras Alnatsheh 1k Dec 20, 2022
Android Library to display your changelog

ChangeLog Library ChangeLog Library provides an easy way to display a change log in your Android app. Travis master: Travis dev: Examples Sample appli

Gabriele Mariotti 861 Nov 11, 2022
Android library to display a list of items for pick one

PickerUI Android library to display a list of items for pick one with blur effect (if you wish). Support for Android 3.0 and up. It supports portrait

David Pizarro 630 Nov 19, 2022
ckChangeLog - An Android Library to display a Change Log

ckChangeLog - An Android Library to display a Change Log This library provides an easy way to display a change log in your app. Features Displays chan

cketti 182 Dec 3, 2022
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.

#DotMatrixView This is an Android library project providing a custom view that can display things on a grid of dots. When the displayed value changes,

Mark Roberts 48 Apr 21, 2022
Android App that communicates with a back-end server to display different One Piece characters

About This project is an Android App that communicates with a back-end server to display different One Piece characters. It's roughly based on this co

Sam Garcia 1 Feb 4, 2022
A swipe button for Android with a circular progress bar for async operations

ProSwipeButton A swipe button for Android with a circular progress bar for async operations Gradle dependencies { ... compile 'in.shadowfax:pr

Shadowfax Technologies 340 Nov 13, 2022
It is a Profile Image View with percentage progress developed in Kotlin.

It is a Profile Image View with percentage progress developed in Kotlin. It is a highly customizable view that offers multiple attributes for creating either dash or continuous progress view around profile image based on your requirements.

smartSense Solutions 16 Jun 23, 2022
ProfilePercentageView - A Profile Image View with percentage progress developed in Kotlin

ProfilePercentageView It is a Profile Image View with percentage progress develo

smartSense Solutions 8 Dec 31, 2021
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

null 3k Dec 30, 2022
An implementation of tap targets from the Material Design guidelines for feature discovery.

TapTargetView An implementation of tap targets from Google's Material Design guidelines on feature discovery. Min SDK: 14 JavaDoc Installation TapTar

Keepsafe 5.2k Dec 30, 2022
AndroidTreeView. TreeView implementation for android

AndroidTreeView Recent changes 2D scrolling mode added, keep in mind this comes with few limitations: you won't be able not place views on right side

Bogdan Melnychuk 2.9k Jan 2, 2023
Proof of concept Android WebView implementation based on Chromium code

Deprecation Notice This project is un-maintained. The recommended alternative is the Crosswalk Project. I did not have the time to keep the project up

Victor Costan 1.7k Dec 25, 2022
A simple implementation of swipe card like StreetView

A simple implementation of swipe card like StreetView!! DONATIONS This project needs you! If you would like to support this project's further developm

Michele Lacorte 831 Jan 4, 2023