summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-26 12:12:00 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:03 +0100
commit3d944d0296801527efdd075e59dab2aac1919d6d (patch)
treee7326b0c7510848b9c76d01e472634b9eb182409 /android
parent0eb5d4014a816e4ab8de38632d2106afeb91b131 (diff)
Basic timer code done.
Change-Id: Ida0233b30f29e667c0c147346debc8306503719f
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/res/layout/presentation_clockbar_countdownbar.xml2
-rw-r--r--android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml4
-rw-r--r--android/sdremote/res/values/strings.xml9
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java42
4 files changed, 47 insertions, 10 deletions
diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
index dc510cef0c8f..dafe925e710c 100644
--- a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -21,6 +21,6 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="Test" />
+ android:text="@string/clock_timer_start" />
</LinearLayout> \ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
index 49d1edd9b33c..d3f5021e4d66 100644
--- a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
@@ -12,13 +12,13 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="Test" />
+ android:text="@string/clock_timer_start" />
<Button
android:id="@+id/clockbar_stopwatch_reset"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="Test" />
+ android:text="@string/clock_timer_reset" />
</LinearLayout> \ No newline at end of file
diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml
index 7c9dae3e4441..991d6929885b 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -7,6 +7,11 @@
<string name="presentation_ui_resizehandle">Handle to resize view.</string>
<string name="presentation_blank_screen">Blank Screen</string>
<string name="options">Options</string>
- <string name="actionbar_timeformat">hh:mm</string>
- <string name="actionbar_timerformat">h:m:ss</string>
+ <string name="actionbar_timeformat">h:mmaa</string>
+ <string name="actionbar_timerformat">mm:ss</string>
+ <string name="clock_timer_start">Start</string>
+ <string name="clock_timer_pause">Pause</string>
+ <string name="clock_timer_restart">Restart</string>
+ <string name="clock_timer_reset">Reset</string>
+ <string name="clock_timer_resume">Resume</string>
</resources> \ No newline at end of file
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 11e07433d675..cbce4ed89ea7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -1,6 +1,7 @@
package org.libreoffice.impressremote;
import org.libreoffice.impressremote.communication.CommunicationService;
+import org.libreoffice.impressremote.communication.SlideShow.Timer;
import android.app.ActionBar;
import android.app.Activity;
@@ -190,12 +191,25 @@ public class PresentationActivity extends Activity {
mStopwatchBar = mLayout.findViewById(R.id.clockbar_stopwatchbar);
mStopwatchBar.setVisibility(View.INVISIBLE);
+ mStopwatchButtonRun = (Button) mStopwatchBar
+ .findViewById(R.id.clockbar_stopwatch_run);
+ mStopwatchButtonReset = (Button) mStopwatchBar
+ .findViewById(R.id.clockbar_stopwatch_reset);
+ mStopwatchButtonRun.setOnClickListener(this);
+ mStopwatchButtonReset.setOnClickListener(this);
+
// Countdown bar
aInflater.inflate(R.layout.presentation_clockbar_countdownbar,
mLayout);
mCountdownBar = mLayout.findViewById(R.id.clockbar_countdownbar);
mCountdownBar.setVisibility(View.INVISIBLE);
+ mCountdownEntry = (EditText) mCountdownBar
+ .findViewById(R.id.clockbar_countdown_time);
+ mCountdownButton = (Button) mCountdownBar
+ .findViewById(R.id.clockbar_countdown_button);
+ mCountdownButton.setOnClickListener(this);
+
updateClockBar();
}
@@ -245,6 +259,7 @@ public class PresentationActivity extends Activity {
@Override
public void onClick(View aSource) {
+ Timer aTimer = mCommunicationService.getSlideShow().getTimer();
// --------------------------------- ACTIONBAR BUTTONS -------------
if (aSource == mThumbnailButton) {
if (!mThumbnailFragment.isVisible()) {
@@ -267,19 +282,36 @@ public class PresentationActivity extends Activity {
}
}
// ------------------------------------ CLOCKBAR BUTTONS -----------
- if (aSource == mClockBar_clockButton) {
+ else if (aSource == mClockBar_clockButton) {
mTimerOn = false;
updateClockBar();
} else if (aSource == mClockBar_stopwatchButton) {
mTimerOn = true;
- mCommunicationService.getSlideShow().getTimer()
- .setCountdown(false);
+ aTimer.setCountdown(false);
updateClockBar();
} else if (aSource == mClockBar_countdownButton) {
mTimerOn = true;
- mCommunicationService.getSlideShow().getTimer()
- .setCountdown(true);
+ aTimer.setCountdown(true);
+ updateClockBar();
+ }
+ // ------------------------------------- TIMER BUTTONS
+ else if (aSource == mStopwatchButtonRun) {
+ if (aTimer.isRunning()) {
+ aTimer.stopTimer();
+ } else {
+ aTimer.startTimer();
+ }
updateClockBar();
+ } else if (aSource == mStopwatchButtonReset) {
+ if (aTimer.isRunning()) {
+ aTimer.reset();
+ aTimer.startTimer();
+ } else {
+ aTimer.reset();
+ }
+
+ } else if (aSource == mCountdownButton) {
+
}
}