diff --git a/app/build.gradle b/app/build.gradle index adfc20a..a42d53a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -13,7 +13,7 @@ android { minSdkVersion 21 targetSdkVersion 29 versionCode 1 - versionName '1.3.0' + versionName '1.3.1' buildConfigField 'String', 'API_IMPL', "\"\"" } diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/MainActivity.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/MainActivity.kt index 03e2e04..fd975b4 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/MainActivity.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/MainActivity.kt @@ -26,7 +26,9 @@ class MainActivity : AppCompatActivity() { } private fun handleOnPause() { - val currentFragment = supportFragmentManager.findFragmentByTag(CURRENT_FRAGMENT_TAG) + val currentFragment = supportFragmentManager.findFragmentByTag( + CURRENT_FRAGMENT_TAG + ) if (currentFragment != null && currentFragment is BtPauseTarget) { currentFragment.btOnPause() } diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/BtDevicesBottomSheet.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/BtDevicesBottomSheet.kt index 81bd2f9..be0428c 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/BtDevicesBottomSheet.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/BtDevicesBottomSheet.kt @@ -32,7 +32,9 @@ class BtDevicesBottomSheet : BaseBottomSheet() { this.btDevices.addAll(btDevices) } - fun setBtDeviceSelectCallback(btConnectTarget: BtConnectTarget) { + fun setBtDeviceSelectCallback( + btConnectTarget: BtConnectTarget + ) { this.btConnectTarget = btConnectTarget } diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/recycler/BtDevicesAdapter.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/recycler/BtDevicesAdapter.kt index 2078023..281e6f0 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/recycler/BtDevicesAdapter.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/deviceselector/recycler/BtDevicesAdapter.kt @@ -13,7 +13,10 @@ class BtDevicesAdapter( private var selectedDeviceMacAddress: String = "" private var selectedDeviceName: String = "" - override fun onBindViewHolder(holderBt: BtDeviceHolder, position: Int) { + override fun onBindViewHolder( + holderBt: BtDeviceHolder, + position: Int + ) { holderBt.bind(btDevices[position]) } @@ -32,8 +35,10 @@ class BtDevicesAdapter( fun getSelectedDeviceMacAddress() = selectedDeviceMacAddress - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = - BtDeviceHolder( + override fun onCreateViewHolder( + parent: ViewGroup, + viewType: Int + ) = BtDeviceHolder( LayoutInflater.from(parent.context) .inflate(R.layout.item_bt_device, parent, false), this diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/MonitorFragment.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/MonitorFragment.kt index 61e66f5..50b2282 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/MonitorFragment.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/MonitorFragment.kt @@ -26,7 +26,7 @@ import com.smlnskgmail.jaman.remotetemperaturecontrol.logic.settings.SettingsBot import kotlinx.android.synthetic.main.fragment_monitor.* @SuppressWarnings("TooManyFunctions") -class MonitorFragment : BaseFragment(), BtMonitorTarget { +class MonitorFragment : BaseFragment(), BtMonitorTarget, BtDisconnectTarget { private var monitorBtConnection: BtConnection? = null private var btAdapter: BluetoothAdapter? = null @@ -201,14 +201,12 @@ class MonitorFragment : BaseFragment(), BtMonitorTarget { private fun showSettings() { val settingsBottomSheet = SettingsBottomSheet() - settingsBottomSheet.setBtDisconnectListener(object : BtDisconnectTarget { - override fun btDisconnect() { - monitorBtConnection!!.disconnect() - resetRequired() - } - }) showBottomSheet(settingsBottomSheet) } + override fun btDisconnect() { + monitorBtConnection!!.disconnect() + resetRequired() + } override fun btOnPause() { monitorBtConnection!!.handleOnResume() diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/impl/debugbt/DebugBtConnection.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/impl/debugbt/DebugBtConnection.kt index 683d986..21e75e3 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/impl/debugbt/DebugBtConnection.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/monitor/impl/debugbt/DebugBtConnection.kt @@ -99,7 +99,9 @@ class DebugBtConnection( ) } - override fun send(btMonitorSignalType: BtMonitorSignalType) { + override fun send( + btMonitorSignalType: BtMonitorSignalType + ) { writeLog( "Debug Monitor: send(${btMonitorSignalType})" ) diff --git a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/settings/SettingsBottomSheet.kt b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/settings/SettingsBottomSheet.kt index 8c3f90c..b669c5e 100644 --- a/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/settings/SettingsBottomSheet.kt +++ b/app/src/main/java/com/smlnskgmail/jaman/remotetemperaturecontrol/logic/settings/SettingsBottomSheet.kt @@ -7,12 +7,10 @@ import kotlinx.android.synthetic.main.bottom_sheet_settings.* class SettingsBottomSheet : BaseBottomSheet() { - private var disconnectTarget: BtDisconnectTarget? = null - override fun initialize() { settings_disconnect.setOnClickListener { actionAndDismiss { - disconnectTarget?.btDisconnect() + (activity as BtDisconnectTarget).btDisconnect() } } } @@ -22,10 +20,6 @@ class SettingsBottomSheet : BaseBottomSheet() { action() } - fun setBtDisconnectListener(disconnectTarget: BtDisconnectTarget) { - this.disconnectTarget = disconnectTarget - } - override fun getLayoutResId() = R.layout.bottom_sheet_settings }