Search in sources :

Example 46 with BaseAdapter

use of android.widget.BaseAdapter in project afwall by ukanth.

the class MainActivity method clearAll.

private void clearAll() {
    if (this.listview == null) {
        this.listview = (ListView) this.findViewById(R.id.listview);
    }
    ListAdapter adapter = listview.getAdapter();
    if (adapter != null) {
        int count = adapter.getCount(), item;
        for (item = 0; item < count; item++) {
            PackageInfoData data = (PackageInfoData) adapter.getItem(item);
            data.selected_wifi = false;
            data.selected_3g = false;
            data.selected_roam = false;
            data.selected_vpn = false;
            data.selected_lan = false;
            // addToQueue(data);
            setDirty(true);
        }
        ((BaseAdapter) adapter).notifyDataSetChanged();
    }
}
Also used : PackageInfoData(dev.ukanth.ufirewall.Api.PackageInfoData) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Example 47 with BaseAdapter

use of android.widget.BaseAdapter in project afwall by ukanth.

the class MainActivity method selectAll3G.

private void selectAll3G(boolean flag) {
    if (this.listview == null) {
        this.listview = (ListView) this.findViewById(R.id.listview);
    }
    ListAdapter adapter = listview.getAdapter();
    if (adapter != null) {
        int count = adapter.getCount(), item;
        for (item = 0; item < count; item++) {
            PackageInfoData data = (PackageInfoData) adapter.getItem(item);
            if (data.uid != Api.SPECIAL_UID_ANY) {
                data.selected_3g = flag;
            // addToQueue(data);
            }
            // addToQueue(data);
            setDirty(true);
        }
        ((BaseAdapter) adapter).notifyDataSetChanged();
    }
}
Also used : PackageInfoData(dev.ukanth.ufirewall.Api.PackageInfoData) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Example 48 with BaseAdapter

use of android.widget.BaseAdapter in project afwall by ukanth.

the class MainActivity method selectAllVPN.

/**
 * Cache any batch event by user
 *
 * @param
 */
/*public static void addToQueue(@NonNull PackageInfoData data) {
        */
/*if (queue == null) {
            queue = new HashSet<>();
        }
        //add or update based on new data
        queue.add(data);
        getFab().setBackgroundTintList(ColorStateList.valueOf(Color.RED));*/
/*
    }*/
private void selectAllVPN(boolean flag) {
    if (this.listview == null) {
        this.listview = (ListView) this.findViewById(R.id.listview);
    }
    ListAdapter adapter = listview.getAdapter();
    if (adapter != null) {
        int count = adapter.getCount(), item;
        for (item = 0; item < count; item++) {
            PackageInfoData data = (PackageInfoData) adapter.getItem(item);
            if (data.uid != Api.SPECIAL_UID_ANY) {
                data.selected_vpn = flag;
            // addToQueue(data);
            }
            setDirty(true);
        }
        ((BaseAdapter) adapter).notifyDataSetChanged();
    }
}
Also used : PackageInfoData(dev.ukanth.ufirewall.Api.PackageInfoData) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Example 49 with BaseAdapter

use of android.widget.BaseAdapter in project AutoLoadListView by ZhaoKaiQiang.

the class ZSwipeItem method isEnabledInAdapterView.

/**
 * if working in {@link android.widget.AdapterView}, we should response
 * {@link android.widget.Adapter} isEnable(int position).
 *
 * @return true when item is enabled, else disabled.
 */
private boolean isEnabledInAdapterView() {
    @SuppressWarnings("rawtypes") AdapterView adapterView = getAdapterView();
    boolean enable = true;
    if (adapterView != null) {
        Adapter adapter = adapterView.getAdapter();
        if (adapter != null) {
            int p = adapterView.getPositionForView(ZSwipeItem.this);
            if (adapter instanceof BaseAdapter) {
                enable = ((BaseAdapter) adapter).isEnabled(p);
            } else if (adapter instanceof ListAdapter) {
                enable = ((ListAdapter) adapter).isEnabled(p);
            }
        }
    }
    return enable;
}
Also used : AdapterView(android.widget.AdapterView) Adapter(android.widget.Adapter) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter) BaseAdapter(android.widget.BaseAdapter) SuppressLint(android.annotation.SuppressLint) ListAdapter(android.widget.ListAdapter)

Example 50 with BaseAdapter

use of android.widget.BaseAdapter in project chefly_android by chef-ly.

the class ListViewFragment method onLoadFinished.

// LoaderManager callback method
@Override
public void onLoadFinished(Loader<RecipeList> loader, RecipeList data) {
    Log.d(TAG + "/" + title, "Loader - OnLoadFinish");
    for (RecipeInformation recipe : data) {
        list.add(recipe);
    }
    ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
    isLoading.set(false);
    Log.d(TAG, "Getting more recipes from server --- Done");
}
Also used : BaseAdapter(android.widget.BaseAdapter) RecipeInformation(com.se491.chef_ly.model.RecipeInformation)

Aggregations

BaseAdapter (android.widget.BaseAdapter)63 View (android.view.View)30 AdapterView (android.widget.AdapterView)26 ViewGroup (android.view.ViewGroup)22 TextView (android.widget.TextView)21 ListAdapter (android.widget.ListAdapter)16 Adapter (android.widget.Adapter)15 ListView (android.widget.ListView)11 PackageInfoData (dev.ukanth.ufirewall.Api.PackageInfoData)8 RemoteAdapterConnectionCallback (android.widget.RemoteViewsAdapter.RemoteAdapterConnectionCallback)7 Intent (android.content.Intent)5 LayoutInflater (android.view.LayoutInflater)5 SuppressLint (android.annotation.SuppressLint)4 Context (android.content.Context)4 AbsListView (android.widget.AbsListView)4 GridView (android.widget.GridView)4 ImageView (android.widget.ImageView)4 RecyclerView (android.support.v7.widget.RecyclerView)3 MenuItem (android.view.MenuItem)3 HeaderViewListAdapter (android.widget.HeaderViewListAdapter)3