Android Open Source - box-android-sdk-v2-master Navigation List Adapter






From Project

Back to project page box-android-sdk-v2-master.

License

The source code is released under:

Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRI...

If you think the Android project box-android-sdk-v2-master 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.box.boxandroidlibv2.adapters;
//w  w  w  . ja va 2s  . c om
import java.util.ArrayList;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.box.boxandroidlibv2.R;
import com.box.boxandroidlibv2.viewdata.NavigationItem;

/**
 * Adapter for navigation items.
 * 
 */
public class NavigationListAdapter extends ArrayAdapter<NavigationItem> {

    /** Layout inflater. */
    private final LayoutInflater mInflater;

    /**
     * Constructor based on array of NavigationTreeItems.
     * 
     * @param activity
     *            current activity.
     * @param navigationItems
     *            List of NavigationTreeItem.
     */
    public NavigationListAdapter(final Activity activity, final ArrayList<NavigationItem> navigationItems) {
        super(activity, 0);
        mInflater = LayoutInflater.from(activity);
        setNavigationList(navigationItems);
    }

    /**
     * Set the list of NavigationTreeItems.
     * 
     * @param navigationItems
     *            List of NavigationTreeItem.
     */
    public void setNavigationList(final ArrayList<NavigationItem> navigationItems) {
        clear();
        setNotifyOnChange(false);
        for (NavigationItem treeItem : navigationItems) {
            this.add(treeItem);
        }
        setNotifyOnChange(true);
        notifyDataSetChanged();
    }

    @Override
    public boolean isEnabled(final int position) {
        return true;
    }

    @Override
    public View getView(final int position, final View convertView, final ViewGroup parent) {

        View v = mInflater.inflate(R.layout.boxandroidlibv2_navigation_item_folder, parent, false);
        if (v == null) {
            return null;
        }

        TextView tv = (TextView) v.findViewById(R.id.textView_navigationItem);
        NavigationItem item = getItem(position);
        tv.setText(item.toString());
        return v;
    }

    @Override
    public View getDropDownView(final int position, final View convertView, final ViewGroup parent) {

        View v = mInflater.inflate(R.layout.boxandroidlibv2_navigation_dropdown_item_folder, parent, false);
        if (v == null) {
            return null;
        }

        TextView tv = (TextView) v.findViewById(R.id.textView_navigationItem);
        NavigationItem item = getItem(position);
        tv.setText(item.toString());
        return v;
    }
}




Java Source Code List

com.box.android.sample.BoxSDKSampleApplication.java
com.box.android.sample.FileListActivity.java
com.box.android.sample.FileListAdapter.java
com.box.androidlibv2.sample.oauth.OAuthActivity.java
com.box.androidlibv2.sample.oauth.OAuthSampleApplication.java
com.box.boxandroidlibv2.BoxAndroidClient.java
com.box.boxandroidlibv2.BoxAndroidConfig.java
com.box.boxandroidlibv2.activities.FilePickerActivity.java
com.box.boxandroidlibv2.activities.FolderNavigationActivity.java
com.box.boxandroidlibv2.activities.FolderPickerActivity.java
com.box.boxandroidlibv2.activities.OAuthActivity.java
com.box.boxandroidlibv2.adapters.BoxListItemAdapter.java
com.box.boxandroidlibv2.adapters.NavigationListAdapter.java
com.box.boxandroidlibv2.dao.BoxAndroidCollaboration.java
com.box.boxandroidlibv2.dao.BoxAndroidCollection.java
com.box.boxandroidlibv2.dao.BoxAndroidComment.java
com.box.boxandroidlibv2.dao.BoxAndroidEmailAlias.java
com.box.boxandroidlibv2.dao.BoxAndroidEmail.java
com.box.boxandroidlibv2.dao.BoxAndroidEnterprise.java
com.box.boxandroidlibv2.dao.BoxAndroidEventCollection.java
com.box.boxandroidlibv2.dao.BoxAndroidEvent.java
com.box.boxandroidlibv2.dao.BoxAndroidFileVersion.java
com.box.boxandroidlibv2.dao.BoxAndroidFile.java
com.box.boxandroidlibv2.dao.BoxAndroidFolder.java
com.box.boxandroidlibv2.dao.BoxAndroidGroupMembership.java
com.box.boxandroidlibv2.dao.BoxAndroidGroup.java
com.box.boxandroidlibv2.dao.BoxAndroidOAuthData.java
com.box.boxandroidlibv2.dao.BoxAndroidSharedLinkPermissions.java
com.box.boxandroidlibv2.dao.BoxAndroidSharedLink.java
com.box.boxandroidlibv2.dao.BoxAndroidUser.java
com.box.boxandroidlibv2.dao.BoxAndroidWebLink.java
com.box.boxandroidlibv2.dao.BoxParcel.java
com.box.boxandroidlibv2.exceptions.BoxAndroidLibException.java
com.box.boxandroidlibv2.exceptions.IBoxAndroidLibException.java
com.box.boxandroidlibv2.exceptions.UserTerminationException.java
com.box.boxandroidlibv2.jsonparsing.AndroidBoxResourceHub.java
com.box.boxandroidlibv2.manager.ThumbnailManager.java
com.box.boxandroidlibv2.viewdata.BoxListItem.java
com.box.boxandroidlibv2.viewdata.NavigationItem.java
com.box.boxandroidlibv2.viewlisteners.OAuthWebViewListener.java
com.box.boxandroidlibv2.viewlisteners.StringMessage.java
com.box.boxandroidlibv2.views.OAuthWebView.java
com.example.helloworld.HelloWorldApplication.java
com.example.helloworld.MainActivity.java