diff options
author | Artur Dryomov <artur.dryomov@gmail.com> | 2013-07-17 01:16:02 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-07-25 18:01:57 +0100 |
commit | f39f3ccd590c76d80ff9e02e5cb26fd5119d3de5 (patch) | |
tree | ce8529b085131ceeb6dd5b9ac2a77cc15fcce8c1 /android/sdremote | |
parent | 043a580648ebf3f8fb50bfce9bf03cbfdcda1fd2 (diff) |
Add a basic slide show activity.
Slides grid and pager could be switched now.
Change-Id: I2c29f36b16c247f1d895773d90766828f571a375
Diffstat (limited to 'android/sdremote')
-rw-r--r-- | android/sdremote/AndroidManifest.xml | 7 | ||||
-rwxr-xr-x | android/sdremote/res/drawable-hdpi/ic_action_grid.png | bin | 0 -> 1262 bytes | |||
-rwxr-xr-x | android/sdremote/res/drawable-hdpi/ic_action_pager.png | bin | 0 -> 1388 bytes | |||
-rwxr-xr-x | android/sdremote/res/drawable-mdpi/ic_action_grid.png | bin | 0 -> 1155 bytes | |||
-rwxr-xr-x | android/sdremote/res/drawable-mdpi/ic_action_pager.png | bin | 0 -> 1241 bytes | |||
-rwxr-xr-x | android/sdremote/res/drawable-xhdpi/ic_action_grid.png | bin | 0 -> 1317 bytes | |||
-rwxr-xr-x | android/sdremote/res/drawable-xhdpi/ic_action_pager.png | bin | 0 -> 1552 bytes | |||
-rw-r--r-- | android/sdremote/res/menu/menu_action_bar_slide_show_grid.xml | 10 | ||||
-rw-r--r-- | android/sdremote/res/menu/menu_action_bar_slide_show_pager.xml | 10 | ||||
-rw-r--r-- | android/sdremote/res/values/strings.xml | 4 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/ComputerConnectionFragment.java | 3 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/Intents.java | 4 | ||||
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/SlideShowActivity.java | 104 |
13 files changed, 141 insertions, 1 deletions
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,11 +38,16 @@ <activity android:name=".ComputerCreationActivity" - android:label="Creation" + android:label="@string/title_creation" android:theme="@style/Theme.ImpressRemote.ComputerCreation"> </activity> <activity + android:name=".SlideShowActivity" + android:label="@string/title_slide_show"> + </activity> + + <activity android:name=".SelectorActivity" android:label="@string/selector_choose_a_computer" android:uiOptions="splitActionBarWhenNarrow"> diff --git a/android/sdremote/res/drawable-hdpi/ic_action_grid.png b/android/sdremote/res/drawable-hdpi/ic_action_grid.png Binary files differnew file mode 100755 index 000000000000..6b58c2dab097 --- /dev/null +++ b/android/sdremote/res/drawable-hdpi/ic_action_grid.png diff --git a/android/sdremote/res/drawable-hdpi/ic_action_pager.png b/android/sdremote/res/drawable-hdpi/ic_action_pager.png Binary files differnew file mode 100755 index 000000000000..3f93d3327150 --- /dev/null +++ b/android/sdremote/res/drawable-hdpi/ic_action_pager.png diff --git a/android/sdremote/res/drawable-mdpi/ic_action_grid.png b/android/sdremote/res/drawable-mdpi/ic_action_grid.png Binary files differnew file mode 100755 index 000000000000..5b87a5fbf103 --- /dev/null +++ b/android/sdremote/res/drawable-mdpi/ic_action_grid.png diff --git a/android/sdremote/res/drawable-mdpi/ic_action_pager.png b/android/sdremote/res/drawable-mdpi/ic_action_pager.png Binary files differnew file mode 100755 index 000000000000..9b542d201f95 --- /dev/null +++ b/android/sdremote/res/drawable-mdpi/ic_action_pager.png diff --git a/android/sdremote/res/drawable-xhdpi/ic_action_grid.png b/android/sdremote/res/drawable-xhdpi/ic_action_grid.png Binary files differnew file mode 100755 index 000000000000..4b4355c4d788 --- /dev/null +++ b/android/sdremote/res/drawable-xhdpi/ic_action_grid.png diff --git a/android/sdremote/res/drawable-xhdpi/ic_action_pager.png b/android/sdremote/res/drawable-xhdpi/ic_action_pager.png Binary files differnew file mode 100755 index 000000000000..6d2bfb689430 --- /dev/null +++ b/android/sdremote/res/drawable-xhdpi/ic_action_pager.png diff --git a/android/sdremote/res/menu/menu_action_bar_slide_show_grid.xml b/android/sdremote/res/menu/menu_action_bar_slide_show_grid.xml new file mode 100644 index 000000000000..d65c782669e2 --- /dev/null +++ b/android/sdremote/res/menu/menu_action_bar_slide_show_grid.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/menu_slides_pager" + android:title="@string/menu_slides_pager" + android:icon="@drawable/ic_action_pager" + android:showAsAction="always"/> + +</menu>
\ 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android"> + + <item + android:id="@+id/menu_slides_grid" + android:title="@string/menu_slides_grid" + android:icon="@drawable/ic_action_grid" + android:showAsAction="always"/> + +</menu>
\ 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 @@ <string name="title_wifi" translatable="false">WiFi</string> <string name="title_licenses">Open source licenses</string> <string name="title_connection">Connection</string> + <string name="title_creation">Creation</string> + <string name="title_slide_show">Slide Show</string> <string name="menu_licenses">Open source licenses</string> <string name="menu_reconnect">Reconnect</string> <string name="menu_add_computer">Add computer</string> <string name="menu_remove_computer">Remove</string> + <string name="menu_slides_grid">Slides grid</string> + <string name="menu_slides_pager">Slides pager</string> <string name="button_cancel">Cancel</string> <string name="button_save">Save</string> 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(); + } +} |