diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index 72d692b0eb6d..c2f9ed4aec1e 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -38,10 +38,15 @@ + + + + + + + + \ No newline at end of file diff --git a/android/sdremote/res/menu/menu_action_bar_slide_show_pager.xml b/android/sdremote/res/menu/menu_action_bar_slide_show_pager.xml new file mode 100644 index 000000000000..023dcd5e3301 --- /dev/null +++ b/android/sdremote/res/menu/menu_action_bar_slide_show_pager.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 4e7502dfd3a2..42209c123ae8 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -70,11 +70,15 @@ WiFi Open source licenses Connection + Creation + Slide Show Open source licenses Reconnect Add computer Remove + Slides grid + Slides pager Cancel Save diff --git a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java index e1cc44970754..a9a52a1ab5d4 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java @@ -184,6 +184,9 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv } public void setUpPresentation() { + Intent aIntent = Intents.buildSlideShowIntent(getActivity()); + startActivity(aIntent); + getActivity().finish(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/Intents.java b/android/sdremote/src/org/libreoffice/impressremote/Intents.java index 344175d08752..e517c2dd634a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/Intents.java +++ b/android/sdremote/src/org/libreoffice/impressremote/Intents.java @@ -124,6 +124,10 @@ public final class Intents { return aIntent; } + public static Intent buildSlideShowIntent(Context aContext) { + return new Intent(aContext, SlideShowActivity.class); + } + public static Intent buildLicensesIntent(Context aContext) { return new Intent(aContext, LicensesActivity.class); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SlideShowActivity.java new file mode 100644 index 000000000000..77cf70325a36 --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/SlideShowActivity.java @@ -0,0 +1,104 @@ +package org.libreoffice.impressremote; + +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.support.v4.app.FragmentTransaction; + +import com.actionbarsherlock.app.SherlockFragmentActivity; +import com.actionbarsherlock.view.Menu; +import com.actionbarsherlock.view.MenuItem; + +public class SlideShowActivity extends SherlockFragmentActivity { + private static enum Mode { + PAGER, GRID + } + + private Mode mMode; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mMode = Mode.PAGER; + + setUpHomeButton(); + + setUpFragment(); + } + + private void setUpHomeButton() { + getSupportActionBar().setHomeButtonEnabled(true); + } + + private void setUpFragment() { + switch (mMode) { + case PAGER: + setUpFragment(SlidesPagerFragment.newInstance()); + break; + + case GRID: + setUpFragment(SlidesGridFragment.newInstance()); + break; + + default: + setUpFragment(SlidesPagerFragment.newInstance()); + break; + } + } + + private void setUpFragment(Fragment aFragment) { + FragmentTransaction aTransaction = getSupportFragmentManager().beginTransaction(); + + aTransaction.replace(android.R.id.content, aFragment); + + aTransaction.commit(); + } + + @Override + public boolean onCreateOptionsMenu(Menu aMenu) { + getSupportMenuInflater().inflate(getActionBarMenuResourceId(), aMenu); + + return true; + } + + private int getActionBarMenuResourceId() { + switch (mMode) { + case PAGER: + return R.menu.menu_action_bar_slide_show_pager; + + case GRID: + return R.menu.menu_action_bar_slide_show_grid; + + default: + return R.menu.menu_action_bar_slide_show_pager; + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem aMenuItem) { + switch (aMenuItem.getItemId()) { + case R.id.menu_slides_grid: + mMode = Mode.GRID; + + setUpFragment(); + refreshActionBarMenu(); + + return true; + + case R.id.menu_slides_pager: + mMode = Mode.PAGER; + + setUpFragment(); + refreshActionBarMenu(); + + return true; + + default: + return super.onOptionsItemSelected(aMenuItem); + } + } + + private void refreshActionBarMenu() { + supportInvalidateOptionsMenu(); + } +}