From fa5bd800e967fc3d6237414e1e2f6e5da40cba5a Mon Sep 17 00:00:00 2001 From: Richard Kareko Date: Mon, 27 Jun 2022 14:59:54 +0300 Subject: [PATCH] Rename wifi direct name --- .../WifiDirectDataSharingStrategy.kt | 4 +-- .../p2p/search/ui/P2PDeviceSearchActivity.kt | 27 ++++++++++++------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/p2p-lib/src/main/java/org/smartregister/p2p/data_sharing/WifiDirectDataSharingStrategy.kt b/p2p-lib/src/main/java/org/smartregister/p2p/data_sharing/WifiDirectDataSharingStrategy.kt index b4b6fbcc..a2fb7532 100644 --- a/p2p-lib/src/main/java/org/smartregister/p2p/data_sharing/WifiDirectDataSharingStrategy.kt +++ b/p2p-lib/src/main/java/org/smartregister/p2p/data_sharing/WifiDirectDataSharingStrategy.kt @@ -53,11 +53,11 @@ import timber.log.Timber class WifiDirectDataSharingStrategy : DataSharingStrategy, P2PManagerListener { lateinit var context: Activity - private val wifiP2pManager: WifiP2pManager by lazy(LazyThreadSafetyMode.NONE) { + val wifiP2pManager: WifiP2pManager by lazy(LazyThreadSafetyMode.NONE) { context.getSystemService(Context.WIFI_P2P_SERVICE) as WifiP2pManager } private val accessFineLocationPermissionRequestInt: Int = 12345 - private var wifiP2pChannel: WifiP2pManager.Channel? = null + var wifiP2pChannel: WifiP2pManager.Channel? = null private var wifiP2pReceiver: BroadcastReceiver? = null private var wifiP2pInfo: WifiP2pInfo? = null diff --git a/p2p-lib/src/main/java/org/smartregister/p2p/search/ui/P2PDeviceSearchActivity.kt b/p2p-lib/src/main/java/org/smartregister/p2p/search/ui/P2PDeviceSearchActivity.kt index 0a547df0..0bf34c36 100644 --- a/p2p-lib/src/main/java/org/smartregister/p2p/search/ui/P2PDeviceSearchActivity.kt +++ b/p2p-lib/src/main/java/org/smartregister/p2p/search/ui/P2PDeviceSearchActivity.kt @@ -16,11 +16,16 @@ package org.smartregister.p2p.search.ui import android.Manifest +import android.content.ClipData +import android.content.ClipboardManager import android.content.Intent import android.content.IntentSender import android.content.pm.PackageManager +import android.net.wifi.p2p.WifiP2pDevice +import android.net.wifi.p2p.WifiP2pManager import android.os.Build import android.os.Bundle +import android.provider.Settings import android.view.Menu import android.view.MenuItem import android.view.View @@ -52,6 +57,7 @@ import org.smartregister.p2p.authentication.model.DeviceRole import org.smartregister.p2p.data_sharing.DataSharingStrategy import org.smartregister.p2p.data_sharing.DeviceInfo import org.smartregister.p2p.data_sharing.OnDeviceFound +import org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy import org.smartregister.p2p.search.adapter.DeviceListAdapter import org.smartregister.p2p.search.contract.P2pModeSelectContract import org.smartregister.p2p.utils.DefaultDispatcherProvider @@ -87,7 +93,7 @@ class P2PDeviceSearchActivity : AppCompatActivity(), P2pModeSelectContract.View internal lateinit var interactiveDialog: BottomSheetDialog private var currentConnectedDevice: DeviceInfo? = null - private lateinit var dataSharingStrategy: DataSharingStrategy + private lateinit var dataSharingStrategy: WifiDirectDataSharingStrategy private var keepScreenOnCounter = 0 @@ -108,12 +114,13 @@ class P2PDeviceSearchActivity : AppCompatActivity(), P2pModeSelectContract.View supportActionBar?.setHomeAsUpIndicator(android.R.drawable.ic_menu_close_clear_cancel) // Remaining setup for the DataSharingStrategy class - dataSharingStrategy = P2PLibrary.getInstance().dataSharingStrategy + dataSharingStrategy = P2PLibrary.getInstance().dataSharingStrategy as WifiDirectDataSharingStrategy dataSharingStrategy.setActivity(this) findViewById