Android Open Source - android-tools C F Z List Fragment






From Project

Back to project page android-tools.

License

The source code is released under:

MIT License

If you think the Android project android-tools 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 net.comfreeze.lib.fragments;
/*from   www  . ja  va2 s  . c  o m*/
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

import net.comfreeze.lib.R;

abstract public class CFZListFragment extends Fragment {
    private static final String TAG = CFZListFragment.class.getSimpleName();

    protected OnItemSelectListener listener;

    protected View emptyContainer;
    protected View listContainer;
    protected View listTitleDivider;

    protected TextView title;
    protected TextView intro;

    protected ImageView introIndicator;

    protected ListView list;

    protected Cursor cursor;

    protected ListAdapter adapter;

    protected int layoutId = -1;

    public CFZListFragment() {
        Log.d(TAG, "Initializing");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        Log.d(TAG, "Creating view");
        View view = null;
        if (layoutId > -1) {
            view = inflater.inflate(layoutId, container, false);
            emptyContainer = view.findViewById(R.id.empty_container);
            intro = (TextView) view.findViewById(R.id.list_intro);
            introIndicator = (ImageView) view.findViewById(R.id.list_intro_indicator);
            listContainer = view.findViewById(R.id.list_container);
            list = (ListView) view.findViewById(R.id.list);
            list.setOnItemClickListener(getClickListener());
            list.setOnItemLongClickListener(getLongClickListener());
            title = (TextView) view.findViewById(R.id.list_title);
            listTitleDivider = view.findViewById(R.id.list_title_divider);
        }
        return view;
    }

    public interface OnItemSelectListener {
        public void onItemSelected(View v);

        public void onItemLongPressed(View v);

        public void onCancel();
    }

    abstract public CFZListFragment newInstace();

    public void setOnItemSelectListener(OnItemSelectListener listener) {
        this.listener = listener;
    }

    protected OnItemClickListener clickListener_select = //
            new OnItemClickListener() {
                public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
                    Log.d(TAG, "Item clicked!");
                    if (null != listener) {
                        listener.onItemSelected(view);
                    }
                }
            };

    protected OnItemLongClickListener longClickListener_select = //
            new OnItemLongClickListener() {
                public boolean onItemLongClick(AdapterView<?> adapterView, View view, int position, long id) {
                    Log.d(TAG, "Item long clicked!");
                    if (null != listener) {
                        listener.onItemLongPressed(view);
                    }
                    return false;
                }
            };

    public View getListTitleDivider() {
        return listTitleDivider;
    }

    public void setListTitleDivider(View listTitleDivider) {
        this.listTitleDivider = listTitleDivider;
    }

    public TextView getIntro() {
        return intro;
    }

    public void setIntro(TextView intro) {
        this.intro = intro;
    }

    public ImageView getIntroIndicator() {
        return introIndicator;
    }

    public void setIntroIndicator(ImageView introIndicator) {
        this.introIndicator = introIndicator;
    }

    public int getLayoutId() {
        return layoutId;
    }

    public void setLayoutId(int layoutId) {
        this.layoutId = layoutId;
    }

    public OnItemSelectListener getListener() {
        return listener;
    }

    public void setListener(OnItemSelectListener listener) {
        this.listener = listener;
    }

    public View getEmptyContainer() {
        return emptyContainer;
    }

    public void setEmptyContainer(View emptyContainer) {
        this.emptyContainer = emptyContainer;
    }

    public View getListContainer() {
        return listContainer;
    }

    public void setListContainer(View listContainer) {
        this.listContainer = listContainer;
    }

    public TextView getTitle() {
        return title;
    }

    public void setTitle(TextView title) {
        this.title = title;
    }

    public ListView getList() {
        return list;
    }

    public void setList(ListView list) {
        this.list = list;
    }

    public Cursor getCursor() {
        return cursor;
    }

    public void setCursor(Cursor cursor) {
        this.cursor = cursor;
    }

    public ListAdapter getAdapter() {
        return adapter;
    }

    public void setAdapter(ListAdapter adapter) {
        this.adapter = adapter;
    }

    public OnItemClickListener getClickListener() {
        return clickListener_select;
    }

    public void setClickListener(OnItemClickListener clickListener) {
        this.clickListener_select = clickListener;
    }

    public OnItemLongClickListener getLongClickListener() {
        return longClickListener_select;
    }

    public void setLongClickListener(OnItemLongClickListener longClickListener) {
        this.longClickListener_select = longClickListener;
    }
}




Java Source Code List

net.comfreeze.lib.BundleBuilder.java
net.comfreeze.lib.CFZApplication.java
net.comfreeze.lib.ContentValueBuilder.java
net.comfreeze.lib.FragmentMap.java
net.comfreeze.lib.adapter.HeaderListAdapter.java
net.comfreeze.lib.adapter.IHeaderListAdapter.java
net.comfreeze.lib.adapter.SeparatedListAdapter.java
net.comfreeze.lib.api.BaseAPI.java
net.comfreeze.lib.api.RestAPI.java
net.comfreeze.lib.api.XMLAPI.java
net.comfreeze.lib.api.helper.CursorHelper.java
net.comfreeze.lib.api.helper.JSONHelper.java
net.comfreeze.lib.api.helper.ModelHelper.java
net.comfreeze.lib.api.xml.WordpressAPI.java
net.comfreeze.lib.audio.SoundManager.java
net.comfreeze.lib.db.DatabaseHelper.java
net.comfreeze.lib.db.DatabaseTable.java
net.comfreeze.lib.db.helper.HelperCursor.java
net.comfreeze.lib.db.model.CFZModel.java
net.comfreeze.lib.db.model.FieldColumnMap.java
net.comfreeze.lib.fragments.CFZListFragment.java
net.comfreeze.lib.provider.CFZSimpleProvider.java
net.comfreeze.lib.service.CFZService.java
net.comfreeze.lib.ui.SupportFragmentActivity.java
net.comfreeze.lib.ui.dialog.CFZDialogProgress.java
net.comfreeze.lib.ui.fragment.CFZFragmentBase.java
net.comfreeze.lib.views.BiScrollView.java
net.comfreeze.lib.views.CFZViewHelper.java
net.comfreeze.lib.views.FlowLayout.java
net.comfreeze.lib.views.GestureHelper.java
net.comfreeze.lib.views.HeaderListView.java
net.comfreeze.lib.views.ResizingView.java
net.comfreeze.lib.views.ViewCollection.java
net.comfreeze.lib.views.ViewUtils.java
net.comfreeze.lib.xml.XMLParser.java
net.comfreeze.lib.xml.wordpress.FeedXmlParser.java