Add a basic slide show activity.

Slides grid and pager could be switched now.

Change-Id: I2c29f36b16c247f1d895773d90766828f571a375
This commit is contained in:
Artur Dryomov 2013-07-17 01:16:02 +03:00 committed by Michael Meeks
parent 043a580648
commit f39f3ccd59
13 changed files with 141 additions and 1 deletions

View File

@ -38,10 +38,15 @@
<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"

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -184,6 +184,9 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv
}
public void setUpPresentation() {
Intent aIntent = Intents.buildSlideShowIntent(getActivity());
startActivity(aIntent);
getActivity().finish();
}

View File

@ -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);
}

View File

@ -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();
}
}