Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: feature to turn bluetooth on #585

Merged
merged 5 commits into from
Dec 30, 2019
Merged

feat: feature to turn bluetooth on #585

merged 5 commits into from
Dec 30, 2019

Conversation

refactor-droidyy
Copy link
Member

Fixes #584

Screenshots for the change:

bluetooth

@auto-label auto-label bot added the feature label Dec 29, 2019
@refactor-droidyy
Copy link
Member Author

@adityastic please review.

Copy link
Collaborator

@adityastic adityastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, This would be very handy. Can you shift the bluetooth adapter from the textfragment and make it a singleton and use it to perform bluetooth operations

@refactor-droidyy
Copy link
Member Author

refactor-droidyy commented Dec 30, 2019

Screenshots

createBadgeBluetooth

savedBadgeBluetooth

@@ -77,6 +77,7 @@ class TextArtFragment : BaseFragment() {
private val modeAdapter = ModeAdapter()

private val viewModel by sharedViewModel<TextArtViewModel>()
private val bluetoothManager: org.fossasia.badgemagic.util.BluetoothManager by inject()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why using FQN


class BluetoothManager(val context: Context) {
private val btManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager
val btAdapter = btManager.adapter!!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this private

if (btAdapter.disable()) {
btAdapter.enable()
if (bluetoothManager.btAdapter.disable()) {
bluetoothManager.btAdapter.enable()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a function inside the singleton to enable bluetooth and shift everything there

}

private fun turnOnBluetooth() {
if (bluetoothManager.btAdapter.disable()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Collaborator

@adityastic adityastic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal Looks good to me 👍👍

@adityastic adityastic merged commit 4032041 into fossasia:development Dec 30, 2019
@refactor-droidyy refactor-droidyy deleted the bluetooth branch December 30, 2019 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On Transfer option select
4 participants