Add a basic slide show activity.
Slides grid and pager could be switched now. Change-Id: I2c29f36b16c247f1d895773d90766828f571a375
This commit is contained in:
committed by
Michael Meeks
parent
043a580648
commit
f39f3ccd59
@@ -38,10 +38,15 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ComputerCreationActivity"
|
android:name=".ComputerCreationActivity"
|
||||||
android:label="Creation"
|
android:label="@string/title_creation"
|
||||||
android:theme="@style/Theme.ImpressRemote.ComputerCreation">
|
android:theme="@style/Theme.ImpressRemote.ComputerCreation">
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".SlideShowActivity"
|
||||||
|
android:label="@string/title_slide_show">
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".SelectorActivity"
|
android:name=".SelectorActivity"
|
||||||
android:label="@string/selector_choose_a_computer"
|
android:label="@string/selector_choose_a_computer"
|
||||||
|
BIN
android/sdremote/res/drawable-hdpi/ic_action_grid.png
Executable file
BIN
android/sdremote/res/drawable-hdpi/ic_action_grid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
android/sdremote/res/drawable-hdpi/ic_action_pager.png
Executable file
BIN
android/sdremote/res/drawable-hdpi/ic_action_pager.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
android/sdremote/res/drawable-mdpi/ic_action_grid.png
Executable file
BIN
android/sdremote/res/drawable-mdpi/ic_action_grid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
android/sdremote/res/drawable-mdpi/ic_action_pager.png
Executable file
BIN
android/sdremote/res/drawable-mdpi/ic_action_pager.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
android/sdremote/res/drawable-xhdpi/ic_action_grid.png
Executable file
BIN
android/sdremote/res/drawable-xhdpi/ic_action_grid.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
android/sdremote/res/drawable-xhdpi/ic_action_pager.png
Executable file
BIN
android/sdremote/res/drawable-xhdpi/ic_action_pager.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
@@ -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>
|
@@ -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>
|
@@ -70,11 +70,15 @@
|
|||||||
<string name="title_wifi" translatable="false">WiFi</string>
|
<string name="title_wifi" translatable="false">WiFi</string>
|
||||||
<string name="title_licenses">Open source licenses</string>
|
<string name="title_licenses">Open source licenses</string>
|
||||||
<string name="title_connection">Connection</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_licenses">Open source licenses</string>
|
||||||
<string name="menu_reconnect">Reconnect</string>
|
<string name="menu_reconnect">Reconnect</string>
|
||||||
<string name="menu_add_computer">Add computer</string>
|
<string name="menu_add_computer">Add computer</string>
|
||||||
<string name="menu_remove_computer">Remove</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_cancel">Cancel</string>
|
||||||
<string name="button_save">Save</string>
|
<string name="button_save">Save</string>
|
||||||
|
@@ -184,6 +184,9 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUpPresentation() {
|
public void setUpPresentation() {
|
||||||
|
Intent aIntent = Intents.buildSlideShowIntent(getActivity());
|
||||||
|
startActivity(aIntent);
|
||||||
|
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -124,6 +124,10 @@ public final class Intents {
|
|||||||
return aIntent;
|
return aIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Intent buildSlideShowIntent(Context aContext) {
|
||||||
|
return new Intent(aContext, SlideShowActivity.class);
|
||||||
|
}
|
||||||
|
|
||||||
public static Intent buildLicensesIntent(Context aContext) {
|
public static Intent buildLicensesIntent(Context aContext) {
|
||||||
return new Intent(aContext, LicensesActivity.class);
|
return new Intent(aContext, LicensesActivity.class);
|
||||||
}
|
}
|
||||||
|
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user