Search in sources :

Example 11 with PackageInfoData

use of dev.ukanth.ufirewall.Api.PackageInfoData 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 = 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 12 with PackageInfoData

use of dev.ukanth.ufirewall.Api.PackageInfoData in project afwall by ukanth.

the class MainActivity method selectAllWifi.

private void selectAllWifi(boolean flag) {
    if (this.listview == null) {
        this.listview = this.findViewById(R.id.listview);
    }
    ListAdapter adapter = listview.getAdapter();
    int count = adapter.getCount(), item;
    if (adapter != null) {
        for (item = 0; item < count; item++) {
            PackageInfoData data = (PackageInfoData) adapter.getItem(item);
            if (data.uid != Api.SPECIAL_UID_ANY) {
                data.selected_wifi = 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 13 with PackageInfoData

use of dev.ukanth.ufirewall.Api.PackageInfoData in project afwall by ukanth.

the class MainActivity method selectAll3G.

private void selectAll3G(boolean flag) {
    if (this.listview == null) {
        this.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 14 with PackageInfoData

use of dev.ukanth.ufirewall.Api.PackageInfoData in project afwall by ukanth.

the class MainActivity method clearAll.

private void clearAll() {
    if (this.listview == null) {
        this.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_tether = false;
            data.selected_lan = false;
            data.selected_tor = 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 15 with PackageInfoData

use of dev.ukanth.ufirewall.Api.PackageInfoData in project afwall by ukanth.

the class MainActivity method selectAllTor.

private void selectAllTor(boolean flag) {
    if (this.listview == null) {
        this.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_tor = flag;
            // addToQueue(data);
            }
            setDirty(true);
        }
        ((BaseAdapter) adapter).notifyDataSetChanged();
    }
}
Also used : PackageInfoData(dev.ukanth.ufirewall.Api.PackageInfoData) BaseAdapter(android.widget.BaseAdapter) ListAdapter(android.widget.ListAdapter)

Aggregations

PackageInfoData (dev.ukanth.ufirewall.Api.PackageInfoData)16 BaseAdapter (android.widget.BaseAdapter)11 ListAdapter (android.widget.ListAdapter)11 AppListArrayAdapter (dev.ukanth.ufirewall.util.AppListArrayAdapter)3 PackageComparator (dev.ukanth.ufirewall.util.PackageComparator)3 HashSet (java.util.HashSet)3 LinkedHashSet (java.util.LinkedHashSet)3 ActivityNotFoundException (android.content.ActivityNotFoundException)2 ArrayAdapter (android.widget.ArrayAdapter)2 ArrayList (java.util.ArrayList)2 SparseArray (android.util.SparseArray)1 HashMap (java.util.HashMap)1