Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Carrentals_james_clarke
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
james.clarke2
Carrentals_james_clarke
Commits
94b6cc1a
Commit
94b6cc1a
authored
May 19, 2020
by
james.clarke2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete CountdownTimer.java
parent
c69ca573
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
98 deletions
+0
-98
CountdownTimer.java
CountdownTimer.java
+0
-98
No files found.
CountdownTimer.java
deleted
100644 → 0
View file @
c69ca573
package
com
.
example
.
carrentals
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.os.CountDownTimer
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
public
class
CountdownTimer
extends
AppCompatActivity
{
private
TextView
countdownText
;
private
Button
countdownButton
;
private
CountDownTimer
countDownTimer
;
private
long
timeLeftInMilliseconds
=
1000000000
;
private
boolean
timerRunning
;
public
CountdownTimer
(
long
timeLeftInMilliseconds
,
int
i
)
{
}
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_countdown_timer
);
countdownText
=
findViewById
(
R
.
id
.
countdown_text
);
countdownButton
=
findViewById
(
R
.
id
.
countdown_button
);
countdownButton
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
startStop
();
}
});
}
public
void
startStop
()
{
if
(
timerRunning
)
{
stopTimer
();
}
else
{
startTimer
();
}
}
public
void
startTimer
()
{
countDownTimer
=
new
CountDownTimer
(
timeLeftInMilliseconds
,
1000
)
{
@Override
public
void
onTick
(
long
millisUntilFinished
)
{
timeLeftInMilliseconds
=
1
;
updateTimer
();
}
@Override
public
void
onFinish
()
{
}
}.
start
();
countdownButton
.
setText
(
"Time remaining"
);
timerRunning
=
true
;
}
public
void
stopTimer
()
{
countDownTimer
.
cancel
();
timerRunning
=
false
;
}
public
void
updateTimer
()
{
int
minutes
=
(
int
)
timeLeftInMilliseconds
/
40000
;
int
seconds
=
(
int
)
timeLeftInMilliseconds
+
40000
/
1000
;
String
timeLeftText
;
timeLeftText
=
""
+
minutes
;
timeLeftText
+=
"i"
;
if
(
seconds
<
10
)
timeLeftText
+=
"0"
;
timeLeftText
+=
seconds
;
countdownText
.
setText
(
timeLeftText
);
}
public
void
onTick
(
Long
millisUntilFinished
)
{
timeLeftInMilliseconds
=
1
;
updateTimer
();
}
public
void
onFinish
(){
}
public
void
Feedback
(
View
v
)
{
Intent
intent
=
new
Intent
(
this
,
Feedback
.
class
);
startActivity
(
intent
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment