summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-26 10:37:19 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:03 +0100
commit847f98033c03fb6a07e64f8c9227d348a316f8ae (patch)
treed5eb5470ccd15eac6694cec2e1fe4f9259d1e586 /android
parent43622ed14489dac4b3f80972fadf260e7297bb37 (diff)
Fixed clockbar toggling.
Change-Id: Ifd7a5f5a18a507db70b198943418e1e468ebcce0
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java87
1 files changed, 56 insertions, 31 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 0c9e56f5249d..10eb0283356f 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -110,7 +110,11 @@ public class PresentationActivity extends Activity {
private ToggleButton mTimeLabel;
private ToggleButton mThumbnailButton;
+ // ------- CLOCKBAR
private View mClockBar;
+ private ToggleButton mClockBar_clockButton;
+ private ToggleButton mClockBar_stopwatchButton;
+ private ToggleButton mClockBar_countdownButton;
private String aTimeFormat = getResources().getString(
R.string.actionbar_timeformat);
@@ -140,6 +144,8 @@ public class PresentationActivity extends Activity {
R.id.actionbar_time);
mTimeLabel.setOnClickListener(this);
+ setupClockBar();
+
// Listen for fragment changes
getFragmentManager().addOnBackStackChangedListener(this);
@@ -149,6 +155,36 @@ public class PresentationActivity extends Activity {
}
+ private void setupClockBar() {
+ LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ aInflater.inflate(R.layout.presentation_clockbar, mLayout);
+ mClockBar = mLayout.findViewById(R.id.clockbar);
+ mClockBar.setVisibility(View.INVISIBLE);
+
+ mClockBar_clockButton = (ToggleButton) mClockBar
+ .findViewById(R.id.clockbar_toggle_clockmode);
+ mClockBar_stopwatchButton = (ToggleButton) mClockBar
+ .findViewById(R.id.clockbar_toggle_stopwatchmode);
+ mClockBar_countdownButton = (ToggleButton) mClockBar
+ .findViewById(R.id.clockbar_toggle_countdownmode);
+ mClockBar_clockButton.setOnClickListener(this);
+ mClockBar_stopwatchButton.setOnClickListener(this);
+ mClockBar_countdownButton.setOnClickListener(this);
+
+ updateClockBar();
+
+ }
+
+ private void updateClockBar() {
+ // TODO: show/hide the sub bar
+ mClockBar_clockButton.setChecked(!mTimerOn);
+
+ boolean aIsCountdown = mCommunicationService.getSlideShow()
+ .getTimer().isCountdown();
+ mClockBar_stopwatchButton.setChecked(mTimerOn && !aIsCountdown);
+ mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
+ }
+
private Handler timerHandler = new Handler();
private Thread timerUpdateThread = new Thread() {
@@ -175,6 +211,7 @@ public class PresentationActivity extends Activity {
@Override
public void onClick(View aSource) {
+ // --------------------------------- ACTIONBAR BUTTONS -------------
if (aSource == mThumbnailButton) {
if (!mThumbnailFragment.isVisible()) {
FragmentTransaction ft = getFragmentManager()
@@ -187,41 +224,29 @@ public class PresentationActivity extends Activity {
getFragmentManager().popBackStack();
}
} else if (aSource == mTimeLabel) {
- if (mClockBar == null) {
- LayoutInflater aInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- mClockBar = aInflater.inflate(
- R.layout.presentation_clockbar, mLayout);
- mClockBar = mLayout.findViewById(R.id.clockbar);
- if (!mTimerOn) {
- ((ToggleButton) mClockBar
- .findViewById(R.id.clockbar_toggle_clockmode))
- .setChecked(true);
- } else {
- boolean aIsCountdown = mCommunicationService
- .getSlideShow().getTimer()
- .isCountdown();
- ((ToggleButton) mClockBar
- .findViewById(R.id.clockbar_toggle_stopwatchmode))
- .setChecked(!aIsCountdown);
- ((ToggleButton) mClockBar
- .findViewById(R.id.clockbar_toggle_countdownmode))
- .setChecked(aIsCountdown);
- }
+ if (mClockBar.getVisibility() == View.VISIBLE) {
+ mClockBar.setVisibility(View.INVISIBLE);
} else {
- // mClockBar.setVisibility(View.INVISIBLE);
-
- // ((ViewGroup) mClockBar.getParent()).removeView(mClockBar);
- if (mClockBar.getVisibility() == View.VISIBLE) {
- mClockBar.setVisibility(View.INVISIBLE);
- } else {
- mClockBar.setVisibility(View.VISIBLE);
- mClockBar.bringToFront();
- }
- // mLayout.removeView(mClockBar);
- // mClockBar = null;
+ mClockBar.setVisibility(View.VISIBLE);
+ mClockBar.bringToFront();
}
}
+ // ------------------------------------ CLOCKBAR BUTTONS -----------
+ if (aSource == mClockBar_clockButton) {
+ mTimerOn = false;
+ updateClockBar();
+ } else if (aSource == mClockBar_stopwatchButton) {
+ mTimerOn = true;
+ mCommunicationService.getSlideShow().getTimer()
+ .setCountdown(false);
+ updateClockBar();
+ } else if (aSource == mClockBar_countdownButton) {
+ mTimerOn = true;
+ mCommunicationService.getSlideShow().getTimer()
+ .setCountdown(true);
+ updateClockBar();
+ }
}