Android Open Source - UniversalLoader U L Fragment






From Project

Back to project page UniversalLoader.

License

The source code is released under:

Apache License

If you think the Android project UniversalLoader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.michaelflisar.universalloader.fragments;
//  w ww .j  av  a 2  s .c om
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.michaelflisar.universalloader.ULFragmentImpl;
import com.michaelflisar.universalloader.UniversalLoader;
import com.michaelflisar.universalloader.data.fragments.ULFragmentLoaders;
import com.michaelflisar.universalloader.data.main.ULFragmentKey;
import com.michaelflisar.universalloader.data.main.ULKey;
import com.michaelflisar.universalloader.data.main.ULResult;
import com.michaelflisar.universalloader.interfaces.IFragmentImplParent;
import com.michaelflisar.universalloader.interfaces.IUniversalLoaderProvider;

public abstract class ULFragment extends Fragment implements IFragmentImplParent
{
    private ULFragmentImpl mFragmentImpl = null;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        mFragmentImpl = new ULFragmentImpl(this);
        mFragmentImpl.onCreate();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        View userView = onCreateUserView(inflater, container, savedInstanceState);
        View v = mFragmentImpl.onCreateView(inflater, container, userView);
        return v;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState)
    {
        super.onActivityCreated(savedInstanceState);
        if (!(getActivity() instanceof IUniversalLoaderProvider))
            throw new RuntimeException("the parent activity of an ULFragment MUST implement IUniversalLoaderProvider!");
        mFragmentImpl.onActivityCreated((IUniversalLoaderProvider) getActivity(), createLoaders());
    }

    @Override
    public void onStart()
    {
        super.onStart();
        mFragmentImpl.onStart();
    }

    @Override
    public void onResume()
    {
        super.onResume();
        mFragmentImpl.onResume();
    }

    @Override
    public void onPause()
    {
        mFragmentImpl.onPause();
        super.onPause();
    }

    @Override
    public void onStop()
    {
        mFragmentImpl.onStop();
        super.onStop();
    }

    @Override
    public void onDestroyView()
    {
        mFragmentImpl.onDestroyView();
        super.onDestroyView();
    }

    @Override
    public void onDestroy()
    {
        mFragmentImpl.onDestroy();
        super.onDestroy();
    }

    @Override
    public void onDetach()
    {
        mFragmentImpl.onDetach();
        super.onDetach();
    }

    // -----------------------------
    // forward functions
    // -----------------------------

    public UniversalLoader getUniversalLoader()
    {
        return ((IUniversalLoaderProvider) getActivity()).getUniversalLoader();
    }
    
    public ULFragmentKey getFragmentKey()
    {
        return mFragmentImpl.getFragmentKey();
    }
    
    public void disableAutomaticLoadingOverlay()
    {
        mFragmentImpl.disableAutomaticLoadingOverlay();
    }
    
    public void setLoadingState(boolean enabled)
    {
        mFragmentImpl.setLoadingState(enabled);
    }
    
    public void onLoaderStarted()
    {
        
    }

    // -----------------------------
    // abstract functions
    // -----------------------------

    public abstract void onDataReceived(ULKey key, ULResult result);

    public abstract View onCreateUserView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);

    public abstract ULFragmentLoaders createLoaders();
}




Java Source Code List

com.michaelflisar.universalloader.ULActivity.java
com.michaelflisar.universalloader.ULFragmentImpl.java
com.michaelflisar.universalloader.UniversalLoader.java
com.michaelflisar.universalloader.data.fragments.ULFragmentLoaderData.java
com.michaelflisar.universalloader.data.fragments.ULFragmentLoaders.java
com.michaelflisar.universalloader.data.main.ULFragmentKey.java
com.michaelflisar.universalloader.data.main.ULKey.java
com.michaelflisar.universalloader.data.main.ULLoaderDataManager.java
com.michaelflisar.universalloader.data.main.ULResultManager.java
com.michaelflisar.universalloader.data.main.ULResult.java
com.michaelflisar.universalloader.data.main.ULTaskManager.java
com.michaelflisar.universalloader.data.main.ULTask.java
com.michaelflisar.universalloader.demo.Helper.java
com.michaelflisar.universalloader.demo.TestActivity.java
com.michaelflisar.universalloader.demo.TestLoaderFragment.java
com.michaelflisar.universalloader.fragments.ULDialogFragment.java
com.michaelflisar.universalloader.fragments.ULFragment.java
com.michaelflisar.universalloader.helper.ULDebugger.java
com.michaelflisar.universalloader.helper.ULHelper.java
com.michaelflisar.universalloader.interfaces.IFragmentImplParent.java
com.michaelflisar.universalloader.interfaces.IUniversalLoaderListener.java
com.michaelflisar.universalloader.interfaces.IUniversalLoaderProvider.java