summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-09-19 12:47:45 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-09-20 00:17:18 +0300
commit95e95e0a26694dd01412220eb6b44150dfead2bf (patch)
tree63f0fdcaceb15f317ea7e0dbade674088e88df2f /android
parent6d6017e353fe793d571d5d976d27ad0490c6f38a (diff)
Add switching to the slides pager from the grid when selecting a slide.
Change-Id: I029c298a90ff7f0cbaada25388e3a758dc4d583e
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java9
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java25
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/util/Intents.java13
3 files changed, 37 insertions, 10 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index defd6a0cfcaa..3c41eccbd20d 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -40,7 +40,7 @@ import org.libreoffice.impressremote.util.Preferences;
import org.libreoffice.impressremote.util.SavedStates;
public class SlideShowActivity extends SherlockFragmentActivity implements ServiceConnection {
- private static enum Mode {
+ public static enum Mode {
PAGER, GRID, EMPTY
}
@@ -160,6 +160,12 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
@Override
public void onReceive(Context aContext, Intent aIntent) {
+ if (Intents.Actions.SLIDE_SHOW_MODE_CHANGED.equals(aIntent.getAction())) {
+ Mode aMode = (Mode) aIntent.getSerializableExtra(Intents.Extras.MODE);
+ mSlideShowActivity.changeMode(aMode);
+ return;
+ }
+
if (Intents.Actions.SLIDE_CHANGED.equals(aIntent.getAction())) {
mSlideShowActivity.setUpSlideShowInformation();
return;
@@ -193,6 +199,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
private IntentFilter buildIntentsReceiverFilter() {
IntentFilter aIntentFilter = new IntentFilter();
+ aIntentFilter.addAction(Intents.Actions.SLIDE_SHOW_MODE_CHANGED);
aIntentFilter.addAction(Intents.Actions.SLIDE_CHANGED);
aIntentFilter.addAction(Intents.Actions.TIMER_UPDATED);
aIntentFilter.addAction(Intents.Actions.TIMER_STARTED);
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
index 14e46e0a1dac..053648b8cb88 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java
@@ -24,6 +24,7 @@ import android.widget.AdapterView;
import android.widget.GridView;
import com.actionbarsherlock.app.SherlockFragment;
+import org.libreoffice.impressremote.activity.SlideShowActivity;
import org.libreoffice.impressremote.communication.SlideShow;
import org.libreoffice.impressremote.util.Intents;
import org.libreoffice.impressremote.R;
@@ -86,7 +87,23 @@ public class SlidesGridFragment extends SherlockFragment implements ServiceConne
@Override
public void onItemClick(AdapterView<?> aAdapterView, View aView, int aPosition, long aId) {
- mCommunicationService.getCommandsTransmitter().setCurrentSlide(aPosition);
+ changeCurrentSlide(aPosition);
+ changeSlideShowMode();
+ }
+
+ private void changeCurrentSlide(int aSlideIndex) {
+ mCommunicationService.getCommandsTransmitter().setCurrentSlide(aSlideIndex);
+ }
+
+ private void changeSlideShowMode() {
+ Intent aIntent = Intents.buildSlideShowModeChangedIntent(SlideShowActivity.Mode.PAGER);
+ getBroadcastManager().sendBroadcast(aIntent);
+ }
+
+ private LocalBroadcastManager getBroadcastManager() {
+ Context aContext = getActivity().getApplicationContext();
+
+ return LocalBroadcastManager.getInstance(aContext);
}
@Override
@@ -138,12 +155,6 @@ public class SlidesGridFragment extends SherlockFragment implements ServiceConne
return aIntentFilter;
}
- private LocalBroadcastManager getBroadcastManager() {
- Context aContext = getActivity().getApplicationContext();
-
- return LocalBroadcastManager.getInstance(aContext);
- }
-
private void refreshSlidesGrid() {
getSlidesGrid().invalidateViews();
}
diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
index a6ade2dc70cd..beab7ae03460 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java
@@ -38,6 +38,8 @@ public final class Intents {
public static final String SLIDE_SHOW_RUNNING = "SLIDE_SHOW_RUNNING";
public static final String SLIDE_SHOW_STOPPED = "SLIDE_SHOW_STOPPED";
+ public static final String SLIDE_SHOW_MODE_CHANGED = "SLIDE_SHOW_MODE_CHANGED";
+
public static final String SLIDE_CHANGED = "SLIDE_CHANGED";
public static final String SLIDE_PREVIEW = "SLIDE_PREVIEW";
public static final String SLIDE_NOTES = "SLIDE_NOTES";
@@ -53,12 +55,12 @@ public final class Intents {
}
public static final String MINUTES = "MINUTES";
+ public static final String MODE = "MODE";
public static final String PIN = "PIN";
- public static final String SLIDE_INDEX = "SLIDE_INDEX";
-
public static final String SERVER = "SERVER";
public static final String SERVER_ADDRESS = "SERVER_ADDRESS";
public static final String SERVER_NAME = "SERVER_NAME";
+ public static final String SLIDE_INDEX = "SLIDE_INDEX";
}
public static final class RequestCodes {
@@ -95,6 +97,13 @@ public final class Intents {
return new Intent(Actions.SLIDE_SHOW_STOPPED);
}
+ public static Intent buildSlideShowModeChangedIntent(SlideShowActivity.Mode aMode) {
+ Intent aIntent = new Intent(Actions.SLIDE_SHOW_MODE_CHANGED);
+ aIntent.putExtra(Extras.MODE, aMode);
+
+ return aIntent;
+ }
+
public static Intent buildSlideChangedIntent(int aSlideIndex) {
Intent aIntent = new Intent(Actions.SLIDE_CHANGED);
aIntent.putExtra(Extras.SLIDE_INDEX, aSlideIndex);