summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-26 18:52:11 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:04 +0100
commit8f08b8f456530a63c76ad1282d6b8643dae15b34 (patch)
tree6b28d2efe8a15ea36ae254c63b036b70fe8fd1a7 /android
parent148281ad8a6466b62055718f8f4071b43efa1408 (diff)
Added automatic hiding of clockbar as necessary.
Change-Id: Id758f8e3f73e9d7d180e09b606ee44cbe5c48d6c
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/res/layout/idlayout.xml9
-rw-r--r--android/sdremote/res/layout/presentation_clockbar_countdownbar.xml3
-rw-r--r--android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml8
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java71
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java11
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java2
6 files changed, 82 insertions, 22 deletions
diff --git a/android/sdremote/res/layout/idlayout.xml b/android/sdremote/res/layout/idlayout.xml
new file mode 100644
index 000000000000..6288cbbb7144
--- /dev/null
+++ b/android/sdremote/res/layout/idlayout.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:id="@+id/presentation_innerFrame">
+
+
+</LinearLayout> \ No newline at end of file
diff --git a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
index fb3a648912e3..cc753418d2c2 100644
--- a/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_countdownbar.xml
@@ -23,6 +23,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/clock_timer_start"
- android:textColor="#FFFFFF" />
+ android:textColor="#FFFFFF"
+ android:background="#00000000" />
</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 d3f5021e4d66..5459bec6ebdc 100644
--- a/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
+++ b/android/sdremote/res/layout/presentation_clockbar_stopwatchbar.xml
@@ -12,13 +12,17 @@
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="@string/clock_timer_start" />
+ android:background="#00000000"
+ android:text="@string/clock_timer_start"
+ android:textColor="#FFFFFF" />
<Button
android:id="@+id/clockbar_stopwatch_reset"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
- android:text="@string/clock_timer_reset" />
+ android:background="#00000000"
+ android:text="@string/clock_timer_reset"
+ android:textColor="#FFFFFF" />
</LinearLayout> \ 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 b9c2091ea503..fb24076a5e22 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -25,6 +25,7 @@ import android.text.format.DateFormat;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@@ -37,6 +38,7 @@ public class PresentationActivity extends Activity {
private CommunicationService mCommunicationService;
private boolean mIsBound = false;
private FrameLayout mLayout;
+ private FrameLayout mOuterLayout;
private ThumbnailFragment mThumbnailFragment;
private PresentationFragment mPresentationFragment;
private ActionBarManager mActionBarManager;
@@ -50,15 +52,19 @@ public class PresentationActivity extends Activity {
mIsBound = true;
setContentView(R.layout.activity_presentation);
- mLayout = (FrameLayout) findViewById(R.id.framelayout);
+ mOuterLayout = (FrameLayout) findViewById(R.id.framelayout);
+ mLayout = new InterceptorLayout(this);
+ mOuterLayout.addView(mLayout);
+ mLayout.setId(R.id.presentation_innerFrame);
+ // ((FrameLayout) findViewById(R.id.framelayout)).addView(mLayout);
mThumbnailFragment = new ThumbnailFragment();
mPresentationFragment = new PresentationFragment();
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager
.beginTransaction();
- fragmentTransaction.add(R.id.framelayout, mPresentationFragment,
- "fragment_presentation");
+ fragmentTransaction.add(R.id.presentation_innerFrame,
+ mPresentationFragment, "fragment_presentation");
fragmentTransaction.commit();
}
@@ -155,12 +161,20 @@ public class PresentationActivity extends Activity {
}
+ public void hidePopups() {
+ if (mClockBar.getVisibility() == View.VISIBLE) {
+ mClockBar.setVisibility(View.INVISIBLE);
+ mStopwatchBar.setVisibility(View.INVISIBLE);
+ mCountdownBar.setVisibility(View.INVISIBLE);
+ mTimeLabel.setChecked(false);
+ }
+ }
+
private void setupClockBar() {
// ClockBar
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);
+ aInflater.inflate(R.layout.presentation_clockbar, mOuterLayout);
+ mClockBar = mOuterLayout.findViewById(R.id.clockbar);
mClockBar_clockButton = (ToggleButton) mClockBar
.findViewById(R.id.clockbar_toggle_clockmode);
@@ -174,9 +188,9 @@ public class PresentationActivity extends Activity {
// Stopwatch bar
aInflater.inflate(R.layout.presentation_clockbar_stopwatchbar,
- mLayout);
- mStopwatchBar = mLayout.findViewById(R.id.clockbar_stopwatchbar);
- mStopwatchBar.setVisibility(View.INVISIBLE);
+ mOuterLayout);
+ mStopwatchBar = mOuterLayout
+ .findViewById(R.id.clockbar_stopwatchbar);
mStopwatchButtonRun = (Button) mStopwatchBar
.findViewById(R.id.clockbar_stopwatch_run);
@@ -187,9 +201,9 @@ public class PresentationActivity extends Activity {
// Countdown bar
aInflater.inflate(R.layout.presentation_clockbar_countdownbar,
- mLayout);
- mCountdownBar = mLayout.findViewById(R.id.clockbar_countdownbar);
- mCountdownBar.setVisibility(View.INVISIBLE);
+ mOuterLayout);
+ mCountdownBar = mOuterLayout
+ .findViewById(R.id.clockbar_countdownbar);
mCountdownEntry = (EditText) mCountdownBar
.findViewById(R.id.clockbar_countdown_time);
@@ -199,6 +213,7 @@ public class PresentationActivity extends Activity {
mCountdownEntry.setOnEditorActionListener(this);
updateClockBar();
+ hidePopups();
}
@@ -215,6 +230,7 @@ public class PresentationActivity extends Activity {
mClockBar_stopwatchButton.setChecked(aStopwatchMode);
mStopwatchBar.setVisibility(aStopwatchMode ? View.VISIBLE
: View.INVISIBLE);
+ mStopwatchBar.bringToFront();
if (aStopwatchMode) {
Timer aTimer = mCommunicationService.getSlideShow().getTimer();
if (aTimer.isRunning()) {
@@ -231,6 +247,7 @@ public class PresentationActivity extends Activity {
mClockBar_countdownButton.setChecked(mTimerOn && aIsCountdown);
mCountdownBar.setVisibility(mTimerOn && aIsCountdown ? View.VISIBLE
: View.INVISIBLE);
+ mCountdownBar.bringToFront();
if (aCountdownMode) {
Timer aTimer = mCommunicationService.getSlideShow().getTimer();
if (aTimer.isRunning()) {
@@ -274,7 +291,7 @@ public class PresentationActivity extends Activity {
if (!mThumbnailFragment.isVisible()) {
FragmentTransaction ft = getFragmentManager()
.beginTransaction();
- ft.replace(R.id.framelayout, mThumbnailFragment);
+ ft.replace(R.id.presentation_innerFrame, mThumbnailFragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
ft.addToBackStack(null);
ft.commit();
@@ -282,11 +299,11 @@ public class PresentationActivity extends Activity {
getFragmentManager().popBackStack();
}
} else if (aSource == mTimeLabel) {
-
if (mClockBar.getVisibility() == View.VISIBLE) {
- mClockBar.setVisibility(View.INVISIBLE);
+ hidePopups();
} else {
mClockBar.setVisibility(View.VISIBLE);
+ updateClockBar();
mClockBar.bringToFront();
}
}
@@ -373,4 +390,28 @@ public class PresentationActivity extends Activity {
}
}
+ /**
+ * Intermediate layout that catches all touches, used in order to hide
+ * the clock menu as appropriate.
+ * @author andy
+ *
+ */
+ private class InterceptorLayout extends FrameLayout {
+
+ public InterceptorLayout(Context context) {
+ super(context);
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent aEvent) {
+ mActionBarManager.hidePopups();
+ return super.onInterceptTouchEvent(aEvent);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent aEvent) {
+ return super.onTouchEvent(aEvent);
+ }
+
+ }
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 7d9f36ab4b47..cf45e09d9cb4 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -90,6 +90,11 @@ public class PresentationFragment extends Fragment {
return v;
}
+ private void updateSlideNumberDisplay() {
+ mNumberText.setText((mSlideShow.getCurrentSlide() + 1) + "/"
+ + mSlideShow.getSize());
+ }
+
// -------------------------------------------------- RESIZING LISTENER ----
private class SizeListener implements OnTouchListener {
@@ -182,6 +187,7 @@ public class PresentationFragment extends Fragment {
mTopView.setOnItemSelectedListener(new ClickListener());
}
+ updateSlideNumberDisplay();
}
public void handleMessage(Message aMessage) {
@@ -190,10 +196,7 @@ public class PresentationFragment extends Fragment {
case CommunicationService.MSG_SLIDE_CHANGED:
int aSlide = aData.getInt("slide_number");
mTopView.setSelection(aSlide, true);
-
- mNumberText.setText((mSlideShow.getCurrentSlide() + 1) + "/"
- + mSlideShow.getSize());
-
+ updateSlideNumberDisplay();
break;
case CommunicationService.MSG_SLIDE_PREVIEW:
int aNSlide = aData.getInt("slide_number");
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
index 6fd3623717ff..6a0496f00db0 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Receiver.java
@@ -37,7 +37,9 @@ public class Receiver {
String aInstruction = aCommand.get(0);
if (aInstruction.equals("slideshow_started")) {
int aSlideShowlength = Integer.parseInt(aCommand.get(1));
+ int aCurrentSlide = Integer.parseInt(aCommand.get(2));
mSlideShow = new SlideShow(aSlideShowlength);
+ mSlideShow.setCurrentSlide(aCurrentSlide);
Message aMessage = Message.obtain(null,
CommunicationService.MSG_SLIDESHOW_STARTED);