Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hotspot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
hotspot
Commits
3e914d52
Commit
3e914d52
authored
3 years ago
by
Sebastian Kürten
Browse files
Options
Downloads
Patches
Plain Diff
Fix button double-tap prevention
parent
a258da12
No related branches found
Branches containing commit
No related tags found
1 merge request
!15
Try starting the WifiP2p framework multiple times with delay if BUSY
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/org/briarproject/hotspot/HotspotFragment.java
+13
-2
13 additions, 2 deletions
...c/main/java/org/briarproject/hotspot/HotspotFragment.java
with
13 additions
and
2 deletions
app/src/main/java/org/briarproject/hotspot/HotspotFragment.java
+
13
−
2
View file @
3e914d52
...
...
@@ -2,6 +2,7 @@ package org.briarproject.hotspot;
import
android.graphics.Bitmap
;
import
android.os.Bundle
;
import
android.os.SystemClock
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
...
...
@@ -136,14 +137,23 @@ public class HotspotFragment extends Fragment {
conditionManager
.
onStart
();
}
private
long
lastClickTime
=
0
;
public
void
onButtonClick
(
View
view
)
{
// don't allow repetitive taps under 1s
if
(
SystemClock
.
elapsedRealtime
()
-
lastClickTime
<
1000
)
{
return
;
}
lastClickTime
=
SystemClock
.
elapsedRealtime
();
onButtonClicked
();
}
private
void
onButtonClicked
()
{
if
(
hotspotStarted
)
{
// the hotspot is currently started → stop it
button
.
setEnabled
(
false
);
viewModel
.
stopWifiP2pHotspot
();
}
else
{
// the hotspot is currently stopped → start it
button
.
setEnabled
(
false
);
startWifiP2pHotspot
();
}
}
...
...
@@ -151,6 +161,7 @@ public class HotspotFragment extends Fragment {
private
void
startWifiP2pHotspot
()
{
if
(
conditionManager
.
checkAndRequestConditions
())
{
viewModel
.
startWifiP2pHotspot
();
button
.
setEnabled
(
false
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment