diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-07-28 13:02:13 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:05 +0100 |
commit | 610fc391cbf3a20f316f960526b2da29b6f9109c (patch) | |
tree | f28d9c8313193ccc62c010ce73b76b7d46a07a73 | |
parent | 8f08b8f456530a63c76ad1282d6b8643dae15b34 (diff) |
Added options screen.
Change-Id: Ifb7abc67383a72969e37d8e46a14fdaa76e47112
8 files changed, 84 insertions, 10 deletions
diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index 4543b718569a..0f8b0fbe1813 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -17,8 +17,7 @@ android:theme="@style/Theme.ImpressRemote" > <activity android:name="TestClient" - android:label="" - > + android:label="" > <intent-filter> <action android:name="android.intent.action.MAIN" /> @@ -33,6 +32,10 @@ android:name=".PresentationActivity" android:label="@string/title_activity_presentation" > </activity> + <activity + android:name=".SettingsActivity" + android:label="@string/options" > + </activity> </application> </manifest>
\ No newline at end of file diff --git a/android/sdremote/res/layout/activity_settings.xml b/android/sdremote/res/layout/activity_settings.xml new file mode 100644 index 000000000000..be5e64506c8e --- /dev/null +++ b/android/sdremote/res/layout/activity_settings.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<fragment xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/settings_fragment" + android:name="org.libreoffice.impressremote.SettingsFragment" + android:layout_width="match_parent" + android:layout_height="match_parent" /> diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 991d6929885b..c3117cfd8038 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -14,4 +14,7 @@ <string name="clock_timer_restart">Restart</string> <string name="clock_timer_reset">Reset</string> <string name="clock_timer_resume">Resume</string> + <string name="options_autodecline">Auto-decline calls</string> + <string name="options_volumeswitching">Change slides using volume buttons</string> + <string name="options_switchcomputer">Switch computer</string> </resources>
\ No newline at end of file diff --git a/android/sdremote/res/values/styles.xml b/android/sdremote/res/values/styles.xml index bb11845e4ad1..04143c4958ef 100644 --- a/android/sdremote/res/values/styles.xml +++ b/android/sdremote/res/values/styles.xml @@ -13,7 +13,6 @@ <style name="Theme.ImpressRemote.ActionBar" parent="android:style/Widget.Holo.Light.ActionBar"> <item name="android:background">@color/orange</item> - <item name="android:displayOptions">showCustom</item> </style> <style name="Theme.ImpressRemote.ActionBarWidget" parent="android:style/Widget.Holo.Light"> diff --git a/android/sdremote/res/xml/preferences.xml b/android/sdremote/res/xml/preferences.xml new file mode 100644 index 000000000000..b475ca617fc4 --- /dev/null +++ b/android/sdremote/res/xml/preferences.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > + <SwitchPreference android:defaultValue="false" android:title="@string/options_autodecline"/> + <SwitchPreference android:defaultValue="false" android:title="@string/options_volumeswitching"/> + + +</PreferenceScreen>
\ No newline at end of file diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java index fb24076a5e22..893452031da5 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java @@ -25,6 +25,7 @@ import android.text.format.DateFormat; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; +import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; @@ -68,13 +69,6 @@ public class PresentationActivity extends Activity { fragmentTransaction.commit(); } - @Override - public boolean onCreateOptionsMenu(Menu menu) { - getMenuInflater().inflate(R.menu.actionbar_presentation, menu); - mActionBarManager = new ActionBarManager(); - return true; - } - private ServiceConnection mConnection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName aClassName, @@ -106,6 +100,34 @@ public class PresentationActivity extends Activity { } } + // ---------------------------------------------- ACTION BAR --------------- + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.actionbar_presentation, menu); + mActionBarManager = new ActionBarManager(); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + Intent aIntent; + switch (item.getItemId()) { + case R.id.actionbar_presentation_submenu_options: + // FragmentTransaction ft = getFragmentManager().beginTransaction(); + // ft.replace(R.id.presentation_innerFrame, new SettingsFragment()); + // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); + // ft.addToBackStack(null); + // ft.commit(); + aIntent = new Intent(this, SettingsActivity.class); + startActivity(aIntent); + return true; + case R.id.actionbar_presentation_submenu_blank: + return true; + default: + return super.onOptionsItemSelected(item); + } + } + private class ActionBarManager implements OnClickListener, FragmentManager.OnBackStackChangedListener, TextView.OnEditorActionListener { @@ -113,6 +135,9 @@ public class PresentationActivity extends Activity { private ToggleButton mTimeLabel; private ToggleButton mThumbnailButton; + private View mDropdownOptions; + private View mDropdownBlank; + // ------- CLOCKBAR private View mClockBar; private ToggleButton mClockBar_clockButton; @@ -142,6 +167,10 @@ public class PresentationActivity extends Activity { public ActionBarManager() { ActionBar aBar = getActionBar(); + aBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, + ActionBar.DISPLAY_SHOW_CUSTOM + | ActionBar.DISPLAY_SHOW_TITLE + | ActionBar.DISPLAY_USE_LOGO); aBar.setCustomView(R.layout.presentation_actionbar); mThumbnailButton = (ToggleButton) aBar.getCustomView() diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java new file mode 100644 index 000000000000..6bdc9fcd344b --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsActivity.java @@ -0,0 +1,14 @@ +package org.libreoffice.impressremote; + +import android.app.Activity; +import android.os.Bundle; + +public class SettingsActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + // TODO Auto-generated method stub + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_settings); + } +} diff --git a/android/sdremote/src/org/libreoffice/impressremote/SettingsFragment.java b/android/sdremote/src/org/libreoffice/impressremote/SettingsFragment.java new file mode 100644 index 000000000000..b6f02f6dcc9d --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/SettingsFragment.java @@ -0,0 +1,13 @@ +package org.libreoffice.impressremote; + +import android.os.Bundle; +import android.preference.PreferenceFragment; + +public class SettingsFragment extends PreferenceFragment { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.preferences); + } +} |