Skip to content

Commit

Permalink
Merge pull request #415 from yashk2000/bt_issue
Browse files Browse the repository at this point in the history
fix: Prevented bluetooth form closing automatically when drawer activity is destroyed.
  • Loading branch information
cweitat authored Jun 28, 2019
2 parents dd96dd5 + e26488f commit c7368e3
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions app/src/main/java/org/fossasia/badgemagic/ui/DrawerActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package org.fossasia.badgemagic.ui
import android.Manifest
import android.app.Activity
import android.app.AlertDialog
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.ActivityInfo
Expand Down Expand Up @@ -249,14 +247,6 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
return packageManager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)
}

private fun disableBluetooth() {
val btManager = getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val btAdapter = btManager.adapter
if (btAdapter.isEnabled) {
btAdapter.disable()
}
}

private fun saveImportFile(uri: Uri?) {
if (StorageUtils.copyFileToDirectory(this, uri)) {
Toast.makeText(this, R.string.success_import_json, Toast.LENGTH_SHORT).show()
Expand Down Expand Up @@ -297,11 +287,6 @@ class DrawerActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedLi
return super.onOptionsItemSelected(item)
}

override fun onDestroy() {
disableBluetooth()
super.onDestroy()
}

override fun onBackPressed() {
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
Expand Down

0 comments on commit c7368e3

Please # to comment.