Search in sources :

Example 1 with WiFiNetwork

use of org.exobel.routerkeygen.algorithms.WiFiNetwork in project routerkeygenAndroid by routerkeygen.

the class NetworkActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_fragment);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    AdsUtils.loadAdIfNeeded(this);
    if (savedInstanceState == null) {
        final Bundle arguments = new Bundle();
        final WiFiNetwork wiFiNetwork = getIntent().getParcelableExtra(NetworkFragment.NETWORK_ID);
        arguments.putParcelable(NetworkFragment.NETWORK_ID, wiFiNetwork);
        setTitle(wiFiNetwork.getSsidName());
        NetworkFragment fragment = new NetworkFragment();
        fragment.setArguments(arguments);
        getFragmentManager().beginTransaction().add(R.id.keygen_fragment, fragment).commit();
    }
}
Also used : Bundle(android.os.Bundle) WiFiNetwork(org.exobel.routerkeygen.algorithms.WiFiNetwork)

Example 2 with WiFiNetwork

use of org.exobel.routerkeygen.algorithms.WiFiNetwork in project routerkeygenAndroid by routerkeygen.

the class NetworksListFragment method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    if (networksFound == null || wifiListAdapter.getCount() <= info.position)
        return;
    final WiFiNetwork wiFiNetwork = wifiListAdapter.getItem(info.position).wifiNetwork;
    if (// the list is unstable and it can happen
    wiFiNetwork == null)
        return;
    MenuInflater inflater = getActivity().getMenuInflater();
    inflater.inflate(R.menu.networks_context_menu, menu);
    // We are copying the values right away as the networks list is
    // unstable.
    menu.findItem(R.id.copy_ssid).setIntent(new Intent().putExtra(MENU_VALUE, wiFiNetwork.getSsidName()));
    menu.findItem(R.id.copy_mac).setIntent(new Intent().putExtra(MENU_VALUE, wiFiNetwork.getMacAddress()));
    menu.findItem(R.id.use_mac).setIntent(new Intent().putExtra(MENU_VALUE, wiFiNetwork.getMacAddress()));
}
Also used : MenuInflater(android.view.MenuInflater) AdapterContextMenuInfo(android.widget.AdapterView.AdapterContextMenuInfo) WiFiNetwork(org.exobel.routerkeygen.algorithms.WiFiNetwork) Intent(android.content.Intent)

Example 3 with WiFiNetwork

use of org.exobel.routerkeygen.algorithms.WiFiNetwork in project routerkeygenAndroid by routerkeygen.

the class NetworksListFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    RelativeLayout root = (RelativeLayout) inflater.inflate(R.layout.fragment_networks_list, container, false);
    listview = (ListView) root.findViewById(R.id.networks_list);
    wifiListAdapter = new WifiListAdapter(getActivity());
    listview.setAdapter(wifiListAdapter);
    noNetworksMessage = root.findViewById(R.id.message_group);
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(NETWORKS_FOUND)) {
            Parcelable[] storedNetworksFound = savedInstanceState.getParcelableArray(NETWORKS_FOUND);
            networksFound = new WiFiNetwork[storedNetworksFound.length];
            for (int i = 0; i < storedNetworksFound.length; ++i) networksFound[i] = (WiFiNetwork) storedNetworksFound[i];
            onScanFinished(networksFound);
        }
        if (savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
            setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
        }
    }
    registerForContextMenu(listview);
    listview.setOnItemClickListener(this);
    return root;
}
Also used : RelativeLayout(android.widget.RelativeLayout) Parcelable(android.os.Parcelable) WiFiNetwork(org.exobel.routerkeygen.algorithms.WiFiNetwork)

Example 4 with WiFiNetwork

use of org.exobel.routerkeygen.algorithms.WiFiNetwork in project routerkeygenAndroid by routerkeygen.

the class WifiListAdapter method updateNetworks.

public void updateNetworks(WiFiNetwork[] list) {
    if (list != null) {
        listNetworks.clear();
        int currentSupportState = -1;
        for (WiFiNetwork wifi : list) {
            if (wifi.getSupportState() != currentSupportState) {
                currentSupportState = wifi.getSupportState();
                switch(currentSupportState) {
                    case Keygen.SUPPORTED:
                        listNetworks.add(new Item(Item.SECTION, R.string.networklist_supported, null, R.color.green_dark));
                        break;
                    case Keygen.UNLIKELY_SUPPORTED:
                        listNetworks.add(new Item(Item.SECTION, R.string.networklist_unlikely_supported, null, R.color.orange_dark));
                        break;
                    case Keygen.UNSUPPORTED:
                        listNetworks.add(new Item(Item.SECTION, R.string.networklist_unsupported, null, R.color.red_dark));
                        break;
                }
            }
            listNetworks.add(new Item(Item.ITEM, 0, wifi, 0));
        }
        notifyDataSetChanged();
    }
}
Also used : WiFiNetwork(org.exobel.routerkeygen.algorithms.WiFiNetwork)

Aggregations

WiFiNetwork (org.exobel.routerkeygen.algorithms.WiFiNetwork)4 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Parcelable (android.os.Parcelable)1 MenuInflater (android.view.MenuInflater)1 AdapterContextMenuInfo (android.widget.AdapterView.AdapterContextMenuInfo)1 RelativeLayout (android.widget.RelativeLayout)1