Search in sources :

Example 1 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project android_packages_apps_Settings by LineageOS.

the class WifiP2pSettings method onPersistentGroupInfoAvailable.

@Override
public void onPersistentGroupInfoAvailable(WifiP2pGroupList groups) {
    mPersistentCategoryController.removeAllChildren();
    for (WifiP2pGroup group : groups.getGroupList()) {
        if (DBG)
            Log.d(TAG, " group " + group);
        WifiP2pPersistentGroup wppg = new WifiP2pPersistentGroup(getPrefContext(), group);
        mPersistentCategoryController.addChild(wppg);
        if (wppg.getGroupName().equals(mSelectedGroupName)) {
            if (DBG)
                Log.d(TAG, "Selecting group " + wppg.getGroupName());
            mSelectedGroup = wppg;
            mSelectedGroupName = null;
        }
    }
    if (mSelectedGroupName != null) {
        // Looks like there's a dialog pending getting user confirmation to delete the
        // selected group. When user hits OK on that dialog, we won't do anything; but we
        // shouldn't be in this situation in first place, because these groups are persistent
        // groups and they shouldn't just get deleted!
        Log.w(TAG, " Selected group " + mSelectedGroupName + " disappered on next query ");
    }
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup)

Example 2 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project android_packages_apps_Settings by SudaMod.

the class WifiP2pSettings method onPersistentGroupInfoAvailable.

@Override
public void onPersistentGroupInfoAvailable(WifiP2pGroupList groups) {
    mPersistentCategoryController.removeAllChildren();
    for (WifiP2pGroup group : groups.getGroupList()) {
        if (DBG)
            Log.d(TAG, " group " + group);
        WifiP2pPersistentGroup wppg = new WifiP2pPersistentGroup(getPrefContext(), group);
        mPersistentCategoryController.addChild(wppg);
        if (wppg.getGroupName().equals(mSelectedGroupName)) {
            if (DBG)
                Log.d(TAG, "Selecting group " + wppg.getGroupName());
            mSelectedGroup = wppg;
            mSelectedGroupName = null;
        }
    }
    if (mSelectedGroupName != null) {
        // Looks like there's a dialog pending getting user confirmation to delete the
        // selected group. When user hits OK on that dialog, we won't do anything; but we
        // shouldn't be in this situation in first place, because these groups are persistent
        // groups and they shouldn't just get deleted!
        Log.w(TAG, " Selected group " + mSelectedGroupName + " disappered on next query ");
    }
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup)

Example 3 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiP2pSettings method onPersistentGroupInfoAvailable.

@Override
public void onPersistentGroupInfoAvailable(WifiP2pGroupList groups) {
    mPersistentCategoryController.removeAllChildren();
    for (WifiP2pGroup group : groups.getGroupList()) {
        if (DBG)
            Log.d(TAG, " group " + group);
        WifiP2pPersistentGroup wppg = new WifiP2pPersistentGroup(getPrefContext(), group);
        mPersistentCategoryController.addChild(wppg);
        if (wppg.getGroupName().equals(mSelectedGroupName)) {
            if (DBG)
                Log.d(TAG, "Selecting group " + wppg.getGroupName());
            mSelectedGroup = wppg;
            mSelectedGroupName = null;
        }
    }
    if (mSelectedGroupName != null) {
        // Looks like there's a dialog pending getting user confirmation to delete the
        // selected group. When user hits OK on that dialog, we won't do anything; but we
        // shouldn't be in this situation in first place, because these groups are persistent
        // groups and they shouldn't just get deleted!
        Log.w(TAG, " Selected group " + mSelectedGroupName + " disappered on next query ");
    }
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup)

Example 4 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project robolectric by robolectric.

the class ShadowWifiP2pManagerTest method requestGroupInfo.

@Test
public void requestGroupInfo() {
    TestGroupInfoListener listener = new TestGroupInfoListener();
    WifiP2pGroup wifiP2pGroup = new WifiP2pGroup();
    shadowOf(wifiP2pGroup).setInterface("ssid");
    shadowOf(wifiP2pGroup).setPassphrase("passphrase");
    shadowOf(wifiP2pGroup).setNetworkName("networkname");
    shadowManager.setGroupInfo(channel, wifiP2pGroup);
    manager.requestGroupInfo(channel, listener);
    shadowMainLooper().idle();
    assertThat(listener.group.getNetworkName()).isEqualTo(wifiP2pGroup.getNetworkName());
    assertThat(listener.group.getInterface()).isEqualTo(wifiP2pGroup.getInterface());
    assertThat(listener.group.getPassphrase()).isEqualTo(wifiP2pGroup.getPassphrase());
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup) Test(org.junit.Test)

Example 5 with WifiP2pGroup

use of android.net.wifi.p2p.WifiP2pGroup in project robolectric by robolectric.

the class ShadowWifiP2pManagerTest method requestGroupInfo_nullListener.

@Test
public void requestGroupInfo_nullListener() {
    WifiP2pGroup wifiP2pGroup = new WifiP2pGroup();
    shadowManager.setGroupInfo(channel, wifiP2pGroup);
    manager.requestGroupInfo(channel, null);
// Should not fail with a null listener
}
Also used : WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup) Test(org.junit.Test)

Aggregations

WifiP2pGroup (android.net.wifi.p2p.WifiP2pGroup)10 Test (org.junit.Test)2 ProgressDialog (android.app.ProgressDialog)1 DialogInterface (android.content.DialogInterface)1 OnCancelListener (android.content.DialogInterface.OnCancelListener)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 WifiP2pConfig (android.net.wifi.p2p.WifiP2pConfig)1 WifiP2pInfo (android.net.wifi.p2p.WifiP2pInfo)1 WifiP2pManager (android.net.wifi.p2p.WifiP2pManager)1 ActionListener (android.net.wifi.p2p.WifiP2pManager.ActionListener)1