android/sdremote/AndroidManifest.xml | 5 android/sdremote/res/layout/activity_requirements.xml | 50 ++++ android/sdremote/res/layout/fragment_computer_connection.xml | 2 android/sdremote/res/layout/fragment_computers_list.xml | 41 +++ android/sdremote/res/layout/fragment_slides_pager.xml | 12 android/sdremote/res/menu/menu_action_bar_computers.xml | 5 android/sdremote/res/values/dimens.xml | 4 android/sdremote/res/values/strings.xml | 12 android/sdremote/res/values/styles.xml | 23 + android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java | 4 android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java | 14 - android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java | 22 + android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java | 4 android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java | 47 +++ android/sdremote/src/org/libreoffice/impressremote/activity/SettingsActivity.java | 4 android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java | 21 - android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java | 4 android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java | 121 ++++++++-- android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java | 4 android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java | 4 android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java | 5 android/sdremote/src/org/libreoffice/impressremote/util/Fragments.java | 2 android/sdremote/src/org/libreoffice/impressremote/util/Intents.java | 5 android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java | 1 android/sdremote/src/org/libreoffice/impressremote/util/SavedStates.java | 2 25 files changed, 359 insertions(+), 59 deletions(-)
New commits: commit 3faefaafa6c7e4b01fe85496f4f288b19c1caebd Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Sat Sep 7 11:54:04 2013 +0300 Fix minor code style issues. Change-Id: I1cc46176efcdc0a869ba711054137e56662d7ab3 diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java index 7a5281d..fda1d96 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerConnectionActivity.java @@ -20,8 +20,8 @@ import org.libreoffice.impressremote.communication.Server; public class ComputerConnectionActivity extends SherlockFragmentActivity { @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + protected void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); setUpHomeButton(); setUpTitle(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java index d229c58..a29d817 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java @@ -36,6 +36,7 @@ import org.libreoffice.impressremote.fragment.TimerSettingDialog; import org.libreoffice.impressremote.util.FragmentOperator; import org.libreoffice.impressremote.util.Intents; import org.libreoffice.impressremote.util.Preferences; +import org.libreoffice.impressremote.util.SavedStates; public class SlideShowActivity extends SherlockFragmentActivity implements ServiceConnection { private static enum Mode { @@ -65,7 +66,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi return Mode.PAGER; } - return (Mode) aSavedInstanceState.getSerializable("MODE"); + return (Mode) aSavedInstanceState.getSerializable(SavedStates.Keys.MODE); } private void setUpHomeButton() { @@ -94,9 +95,9 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi } private boolean isKeepingScreenOnRequired() { - Preferences preferences = Preferences.getSettingsInstance(this); + Preferences aPreferences = Preferences.getSettingsInstance(this); - return preferences.getBoolean(Preferences.Keys.KEEP_SCREEN_ON); + return aPreferences.getBoolean(Preferences.Keys.KEEP_SCREEN_ON); } private void bindService() { @@ -272,9 +273,9 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi } private boolean areVolumeKeysActionsRequired() { - Preferences preferences = Preferences.getSettingsInstance(this); + Preferences aPreferences = Preferences.getSettingsInstance(this); - return preferences.getBoolean(Preferences.Keys.VOLUME_KEYS_ACTIONS); + return aPreferences.getBoolean(Preferences.Keys.VOLUME_KEYS_ACTIONS); } private boolean isLastSlideDisplayed() { @@ -390,8 +391,8 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi } private void callEditingTimer(Timer aTimer) { - DialogFragment aFragment = buildTimerEditingDialog(aTimer); - aFragment.show(getSupportFragmentManager(), TimerEditingDialog.TAG); + DialogFragment aTimerDialog = buildTimerEditingDialog(aTimer); + aTimerDialog.show(getSupportFragmentManager(), TimerEditingDialog.TAG); aTimer.pause(); } @@ -405,8 +406,8 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi } private void callSettingTimer() { - DialogFragment aFragment = TimerSettingDialog.newInstance(); - aFragment.show(getSupportFragmentManager(), TimerSettingDialog.TAG); + DialogFragment aTimerDialog = TimerSettingDialog.newInstance(); + aTimerDialog.show(getSupportFragmentManager(), TimerSettingDialog.TAG); } private void stopSlideShow() { @@ -439,7 +440,7 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi } private void saveMode(Bundle aOutState) { - aOutState.putSerializable("MODE", mMode); + aOutState.putSerializable(SavedStates.Keys.MODE, mMode); } @Override diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java index acd9e60..f72944a 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputerConnectionFragment.java @@ -120,8 +120,8 @@ public class ComputerConnectionFragment extends SherlockFragment implements Serv } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onActivityCreated(Bundle aSavedInstanceState) { + super.onActivityCreated(aSavedInstanceState); bindService(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java index 021a492..616fe40 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesGridFragment.java @@ -44,8 +44,8 @@ public class SlidesGridFragment extends SherlockFragment implements ServiceConne } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onActivityCreated(Bundle aSavedInstanceState) { + super.onActivityCreated(aSavedInstanceState); bindService(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java index 08b5cc2..ae53035 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java @@ -49,8 +49,8 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onActivityCreated(Bundle aSavedInstanceState) { + super.onActivityCreated(aSavedInstanceState); bindService(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java index dd09f4b..8c4c81e 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/TimerEditingDialog.java @@ -20,6 +20,7 @@ import android.widget.TimePicker; import com.actionbarsherlock.app.SherlockDialogFragment; import org.libreoffice.impressremote.R; +import org.libreoffice.impressremote.util.Fragments; import org.libreoffice.impressremote.util.Intents; public class TimerEditingDialog extends SherlockDialogFragment implements TimePickerDialog.OnTimeSetListener, DialogInterface.OnClickListener { @@ -40,7 +41,7 @@ public class TimerEditingDialog extends SherlockDialogFragment implements TimePi private static Bundle buildArguments(int aMinutes) { Bundle aArguments = new Bundle(); - aArguments.putInt("MINUTES", aMinutes); + aArguments.putInt(Fragments.Arguments.MINUTES, aMinutes); return aArguments; } @@ -49,7 +50,7 @@ public class TimerEditingDialog extends SherlockDialogFragment implements TimePi public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mMinutes = getArguments().getInt("MINUTES"); + mMinutes = getArguments().getInt(Fragments.Arguments.MINUTES); } @Override diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Fragments.java b/android/sdremote/src/org/libreoffice/impressremote/util/Fragments.java index b7dbe6d..89752bf 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/Fragments.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/Fragments.java @@ -17,6 +17,8 @@ public final class Fragments { } public static final String COMPUTER = "COMPUTER"; + + public static final String MINUTES = "MINUTES"; } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/SavedStates.java b/android/sdremote/src/org/libreoffice/impressremote/util/SavedStates.java index 0b7a1bb..c9339c8 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/SavedStates.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/SavedStates.java @@ -12,5 +12,7 @@ public final class SavedStates { public static final String PIN = "PIN"; public static final String ERROR_MESSAGE = "ERROR_MESSAGE"; + + public static final String MODE = "MODE"; } } commit 710fc4728f5b3a51b1be1b3ee1400b372e734c1c Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Fri Sep 6 22:01:40 2013 +0300 Fix for blinking while getting back to the computers activity. Change-Id: I5ce3c6462b0d4c1e1fed98cc0510ec9383523458 diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java index 410079e..b6d2b95 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java @@ -133,9 +133,14 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo private void hideComputersList() { ViewAnimator aViewAnimator = getViewAnimator(); - ViewGroup aProgressBarLayout = getProgressBarLayout(); - aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aProgressBarLayout)); + int aProgressBarLayoutIndex = aViewAnimator.indexOfChild(getProgressBarLayout()); + + if (aViewAnimator.getDisplayedChild() == aProgressBarLayoutIndex) { + return; + } + + aViewAnimator.setDisplayedChild(aProgressBarLayoutIndex); } private ViewAnimator getViewAnimator() { @@ -193,7 +198,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo } private void tearDownComputersAdapter() { - getComputesList().setAdapter(null); + setListAdapter(null); } private ListView getComputesList() { commit 8e33646304c34a926a7e8df0ed18c5fc0bc40a3d Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Fri Sep 6 20:19:47 2013 +0300 Fix minor code style issues. Change-Id: I316529388e1e90acd5b62441cf304a61ac71931a diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java index 822d6e1..4e91251 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputerCreationActivity.java @@ -55,7 +55,8 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement } private ActionBar.LayoutParams buildCustomActionBarLayoutParams() { - return new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + return new ActionBar.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); } @@ -128,9 +129,14 @@ public class ComputerCreationActivity extends SherlockFragmentActivity implement } @Override - public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { - if (actionId == EditorInfo.IME_ACTION_DONE) { - saveServer(); + public boolean onEditorAction(TextView aTextView, int aActionId, KeyEvent aKeyEvent) { + switch (aActionId) { + case EditorInfo.IME_ACTION_DONE: + saveServer(); + break; + + default: + break; } return false; diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java index bb82024..954c9fc 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java @@ -37,15 +37,15 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio } @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + protected void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); setUpTitle(); setUpContent(); } private void setUpTitle() { - // Looks hacky but it seems to be the best way to set activity title + // Looks hacky but it seems to be the best way to set activityâs title // different to applicationâs label. The other way is setting title // to intents filter but it shows wrong label for recent apps screen. @@ -145,7 +145,9 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio } private int loadTabIndex() { - return Preferences.getApplicationStatesInstance(this).getInt(Preferences.Keys.SELECTED_COMPUTERS_TAB_INDEX); + Preferences aPreferences = Preferences.getApplicationStatesInstance(this); + + return aPreferences.getInt(Preferences.Keys.SELECTED_COMPUTERS_TAB_INDEX); } private void setUpComputersList() { @@ -227,9 +229,10 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio } private void saveTabIndex() { + Preferences aPreferences = Preferences.getApplicationStatesInstance(this); int aTabIndex = getSupportActionBar().getSelectedNavigationIndex(); - Preferences.getApplicationStatesInstance(this).setInt(Preferences.Keys.SELECTED_COMPUTERS_TAB_INDEX, aTabIndex); + aPreferences.setInt(Preferences.Keys.SELECTED_COMPUTERS_TAB_INDEX, aTabIndex); } } diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java index 8d3dc63..0d11c50 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/LicensesActivity.java @@ -22,8 +22,8 @@ public class LicensesActivity extends SherlockActivity { private static final String PATH = "licenses.html"; @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + protected void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); setContentView(R.layout.activity_licenses); setUpHomeButton(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java index b99023d..0429b6e 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java @@ -16,8 +16,8 @@ import org.libreoffice.impressremote.R; public class RequirementsActivity extends SherlockActivity { @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + protected void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); setContentView(R.layout.activity_requirements); setUpHomeButton(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SettingsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SettingsActivity.java index 612b6c7..ea1a9a5 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/SettingsActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SettingsActivity.java @@ -16,8 +16,8 @@ import org.libreoffice.impressremote.R; public class SettingsActivity extends SherlockPreferenceActivity { @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + protected void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); setUpHomeButton(); setUpPreferences(); diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java index bc71865..410079e 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java @@ -76,8 +76,8 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo } @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + public void onCreate(Bundle aSavedInstanceState) { + super.onCreate(aSavedInstanceState); mType = (Type) getArguments().getSerializable("TYPE"); @@ -89,8 +89,8 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onActivityCreated(Bundle aSavedInstanceState) { + super.onActivityCreated(aSavedInstanceState); bindService(); } diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java index 4ad2490..d63fdd4 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/Preferences.java @@ -29,6 +29,7 @@ public final class Preferences { } public static final String SELECTED_COMPUTERS_TAB_INDEX = "selected_computers_tab_index"; + public static final String VOLUME_KEYS_ACTIONS = "volume_keys_actions"; public static final String KEEP_SCREEN_ON = "keep_screen_on"; } commit 508d32cd03ea60f46794a5b18ec48b005ef80ab5 Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Fri Sep 6 19:12:31 2013 +0300 Fix possible null pointer exception. It is weird anyway. Change-Id: Ibde6e7dc7dc52c556ebc5e6e32ef939a316c5b1b diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java index c892847..bc71865 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java @@ -152,6 +152,10 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo @Override public void run() { + if (!isAdded()) { + return; + } + if (isShowingProgressMessageRequired()) { showProgressMessage(); } commit 2eb19ddb3f5f82efc4ffc882178ca3c6b7886e51 Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Fri Sep 6 18:48:29 2013 +0300 Add showing helper messages while searching computers. Change progress bars from large to average size as well. * It makes them consistent with other Google apps. * It brings better LAF for Gingerbread. Change-Id: Id25a42c9735c3c9948c507eacfbfd64d90d87435 diff --git a/android/sdremote/res/layout/fragment_computer_connection.xml b/android/sdremote/res/layout/fragment_computer_connection.xml index 6ad1290..4caf01c 100644 --- a/android/sdremote/res/layout/fragment_computer_connection.xml +++ b/android/sdremote/res/layout/fragment_computer_connection.xml @@ -8,7 +8,7 @@ <ProgressBar android:id="@+id/progress_bar" - style="?android:progressBarStyleLarge" + style="?android:progressBarStyle" android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content"/> diff --git a/android/sdremote/res/layout/fragment_computers_list.xml b/android/sdremote/res/layout/fragment_computers_list.xml new file mode 100644 index 0000000..c780bab --- /dev/null +++ b/android/sdremote/res/layout/fragment_computers_list.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<ViewAnimator xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/view_animator" + android:inAnimation="@android:anim/fade_in" + android:outAnimation="@android:anim/fade_out" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:animateLayoutChanges="true" + android:id="@+id/container_progress" + android:orientation="vertical" + android:gravity="center" + android:paddingLeft="@dimen/padding_horizontal_progress_layout" + android:paddingRight="@dimen/padding_horizontal_progress_layout" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ProgressBar + android:id="@+id/progress_bar" + style="?android:progressBarStyle" + android:layout_width="wrap_content" + android:layout_height="wrap_content"/> + + <TextView + android:id="@+id/text_progress_message" + android:text="@string/message_search_wifi" + android:gravity="center_horizontal" + android:visibility="invisible" + android:paddingTop="@dimen/padding_vertical_progress_message" + android:layout_width="match_parent" + android:layout_height="wrap_content"/> + + </LinearLayout> + + <ListView + android:id="@android:id/list" + android:layout_width="match_parent" + android:layout_height="match_parent"/> + +</ViewAnimator> \ No newline at end of file diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml index 00054a3..05c7303 100644 --- a/android/sdremote/res/values/dimens.xml +++ b/android/sdremote/res/values/dimens.xml @@ -19,10 +19,12 @@ <dimen name="padding_horizontal_connection_layout">40dp</dimen> <dimen name="padding_horizontal_action_bar_button">20dp</dimen> <dimen name="padding_horizontal_action_bar_divider">12dp</dimen> + <dimen name="padding_horizontal_progress_layout">40dp</dimen> <dimen name="padding_vertical_pin">8dp</dimen> <dimen name="padding_vertical_error_message">12dp</dimen> <dimen name="padding_vertical_edit">8dp</dimen> + <dimen name="padding_vertical_progress_message">8dp</dimen> <dimen name="margin_vertical_action_bar_divider">12dp</dimen> <dimen name="margin_slide">8dp</dimen> diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index c4e5a73..02e2cde 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -38,6 +38,8 @@ <string name="message_impress_pairing_check">If you have Bluetooth pairing issues check instructions related to your desktop OS.</string> <string name="message_ip_address_validation">Type in a valid IP address.</string> <string name="message_time_is_up">Time is up!</string> + <string name="message_search_wifi">Make sure LibreOffice is running on a computer on the same WiFi network.</string> + <string name="message_search_bluetooth">Make sure LibreOffice is running on a computer with Bluetooth enabled.</string> <string name="hint_ip_address">IP address</string> <string name="hint_name">Name (optional)</string> diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java index fffd1cf..c892847 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java @@ -10,6 +10,7 @@ package org.libreoffice.impressremote.fragment; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import android.app.Activity; import android.content.BroadcastReceiver; @@ -19,12 +20,19 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.os.Bundle; +import android.os.Handler; import android.os.IBinder; import android.support.v4.content.LocalBroadcastManager; import android.view.ContextMenu; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; +import android.view.animation.Animation; +import android.view.animation.AnimationUtils; import android.widget.AdapterView; import android.widget.ListView; +import android.widget.TextView; +import android.widget.ViewAnimator; import com.actionbarsherlock.app.SherlockListFragment; import com.actionbarsherlock.view.MenuItem; @@ -34,7 +42,9 @@ import org.libreoffice.impressremote.R; import org.libreoffice.impressremote.communication.CommunicationService; import org.libreoffice.impressremote.communication.Server; -public class ComputersFragment extends SherlockListFragment implements ServiceConnection { +public class ComputersFragment extends SherlockListFragment implements ServiceConnection, Runnable { + private static final int SHOWING_PROGRESS_MESSAGE_DELAY_IN_SECONDS = 10; + public static enum Type { WIFI, BLUETOOTH } @@ -61,6 +71,11 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo } @Override + public View onCreateView(LayoutInflater aInflater, ViewGroup aContainer, Bundle aSavedInstanceState) { + return aInflater.inflate(R.layout.fragment_computers_list, aContainer, false); + } + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -88,7 +103,6 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo @Override public void onServiceConnected(ComponentName aComponentName, IBinder aBinder) { CommunicationService.CBinder aServiceBinder = (CommunicationService.CBinder) aBinder; - mCommunicationService = aServiceBinder.getService(); mCommunicationService.startSearch(); @@ -103,8 +117,12 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo if (getComputers().isEmpty()) { hideComputersList(); + setUpProgressMessage(); + tearDownComputersAdapter(); } else { + setUpComputersAdapter(); + fillComputersAdapter(); showComputersList(); } } @@ -114,20 +132,83 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo } private void hideComputersList() { - setListAdapter(null); + ViewAnimator aViewAnimator = getViewAnimator(); + ViewGroup aProgressBarLayout = getProgressBarLayout(); - setListShown(false); + aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aProgressBarLayout)); } - private void showComputersList() { - if (!isComputersAdapterExist()) { - setUpComputersAdapter(); + private ViewAnimator getViewAnimator() { + return (ViewAnimator) getView().findViewById(R.id.view_animator); + } + + private ViewGroup getProgressBarLayout() { + return (ViewGroup) getView().findViewById(R.id.container_progress); + } + + private void setUpProgressMessage() { + new Handler().postDelayed(this, TimeUnit.SECONDS.toMillis(SHOWING_PROGRESS_MESSAGE_DELAY_IN_SECONDS)); + } + + @Override + public void run() { + if (isShowingProgressMessageRequired()) { + showProgressMessage(); } + } - getComputersAdapter().clear(); - getComputersAdapter().add(getComputers()); + private boolean isShowingProgressMessageRequired() { + return getProgressMessageView().getVisibility() == View.INVISIBLE; + } - setListShown(true); + private TextView getProgressMessageView() { + return (TextView) getView().findViewById(R.id.text_progress_message); + } + + private void showProgressMessage() { + TextView aProgressMessageView = getProgressMessageView(); + Animation aFadeInAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in); + + aProgressMessageView.setText(getProgressMessage()); + + aProgressMessageView.startAnimation(aFadeInAnimation); + aProgressMessageView.setVisibility(View.VISIBLE); + } + + private String getProgressMessage() { + switch (mType) { + case WIFI: + return getString(R.string.message_search_wifi); + + case BLUETOOTH: + return getString(R.string.message_search_bluetooth); + + default: + return ""; + } + } + + private void tearDownComputersAdapter() { + getComputesList().setAdapter(null); + } + + private ListView getComputesList() { + return (ListView) getView().findViewById(android.R.id.list); + } + + private void showComputersList() { + ViewAnimator aViewAnimator = getViewAnimator(); + ListView aComputersList= getComputesList(); + + aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aComputersList)); + } + + private void setUpComputersAdapter() { + if (isComputersAdapterExist()) { + return; + } + + setListAdapter(new ComputersAdapter(getActivity())); } private boolean isComputersAdapterExist() { @@ -138,8 +219,9 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo return (ComputersAdapter) getListAdapter(); } - private void setUpComputersAdapter() { - setListAdapter(new ComputersAdapter(getActivity())); + private void fillComputersAdapter() { + getComputersAdapter().clear(); + getComputersAdapter().add(getComputers()); } private List<Server> getComputers() { commit 275aeab07405b3a07ead39b20ccbc65f4f842c03 Author: Artur Dryomov <artur.dryo...@gmail.com> Date: Thu Sep 5 01:30:59 2013 +0300 Add a requirements screen. Change-Id: Ie3821f4c21853e9c89065a964d069bfde80e81d8 diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml index 7b80b66..6d7064d 100644 --- a/android/sdremote/AndroidManifest.xml +++ b/android/sdremote/AndroidManifest.xml @@ -59,6 +59,11 @@ </activity> <activity + android:name=".activity.RequirementsActivity" + android:label="@string/title_requirements"> + </activity> + + <activity android:name=".activity.LicensesActivity" android:label="@string/title_licenses"> </activity> diff --git a/android/sdremote/res/layout/activity_requirements.xml b/android/sdremote/res/layout/activity_requirements.xml new file mode 100644 index 0000000..138ea56 --- /dev/null +++ b/android/sdremote/res/layout/activity_requirements.xml @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:orientation="vertical" + android:padding="@dimen/padding_help" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <TextView + style="@style/SectionHeader" + android:text="@string/title_generic"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_libreoffice_version"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_libreoffice_general_enabled"/> + + <TextView + style="@style/SectionHeader" + android:text="@string/title_wifi"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_network_connection"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_libreoffice_experimental_enabled"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_network_ports"/> + + <TextView + style="@style/SectionHeader" + android:text="@string/title_bluetooth"/> + + <TextView + style="@style/SectionItem" + android:text="@string/requirements_bluetooth_connection"/> + + </LinearLayout> + +</ScrollView> \ No newline at end of file diff --git a/android/sdremote/res/layout/fragment_slides_pager.xml b/android/sdremote/res/layout/fragment_slides_pager.xml index e51518d..18308a2 100644 --- a/android/sdremote/res/layout/fragment_slides_pager.xml +++ b/android/sdremote/res/layout/fragment_slides_pager.xml @@ -35,17 +35,9 @@ android:layout_height="match_parent"> <TextView + style="@style/SectionHeader" android:text="@string/header_notes" - android:textAllCaps="true" - android:textStyle="bold" - android:textColor="@color/background_header" - android:drawableBottom="@drawable/underline_header" - android:drawablePadding="@dimen/padding_header_underline" - android:paddingLeft="@dimen/padding_header" - android:paddingTop="@dimen/padding_header" - android:gravity="left" - android:layout_width="fill_parent" - android:layout_height="wrap_content"/> + android:paddingTop="@dimen/padding_header"/> <ScrollView android:layout_width="wrap_content" diff --git a/android/sdremote/res/menu/menu_action_bar_computers.xml b/android/sdremote/res/menu/menu_action_bar_computers.xml index f99df21..f78bed9 100644 --- a/android/sdremote/res/menu/menu_action_bar_computers.xml +++ b/android/sdremote/res/menu/menu_action_bar_computers.xml @@ -13,6 +13,11 @@ android:showAsAction="never"/> <item + android:id="@+id/menu_requirements" + android:title="@string/menu_requirements" + android:showAsAction="never"/> + + <item android:id="@+id/menu_licenses" android:title="@string/menu_licenses" android:showAsAction="never"/> diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml index a5f9447..00054a3 100644 --- a/android/sdremote/res/values/dimens.xml +++ b/android/sdremote/res/values/dimens.xml @@ -12,6 +12,8 @@ <dimen name="padding_header_underline">4dp</dimen> <dimen name="padding_header">8dp</dimen> <dimen name="padding_slide_notes">8dp</dimen> + <dimen name="padding_help">16dp</dimen> + <dimen name="padding_section_item">8dp</dimen> <dimen name="padding_horizontal_list_item">8dp</dimen> <dimen name="padding_horizontal_connection_layout">40dp</dimen> diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index f810f0e..c4e5a73 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -4,10 +4,12 @@ <string name="application_name">Impress Remote</string> <string name="title_computers">Computers</string> + <string name="title_generic">Generic</string> <string name="title_bluetooth" translatable="false">Bluetooth</string> <string name="title_wifi" translatable="false">WiFi</string> <string name="title_licenses">Open source licenses</string> <string name="title_settings">Settings</string> + <string name="title_requirements">Requirements</string> <string name="title_connection">Connection</string> <string name="title_creation">Creation</string> <string name="title_slide_show">Slide Show</string> @@ -15,6 +17,7 @@ <string name="menu_licenses">Open source licenses</string> <string name="menu_settings">Settings</string> + <string name="menu_requirements">Requirements</string> <string name="menu_reconnect">Reconnect</string> <string name="menu_add_computer">Add computer</string> <string name="menu_remove_computer">Remove</string> @@ -55,4 +58,11 @@ <string name="preferences_keep_screen_on_title">Screen on</string> <string name="preferences_keep_screen_on_summary">Keep screen on while presenting</string> + <string name="requirements_libreoffice_version">LibreOffice version 4.0.3 or higher running on a computer.</string> + <string name="requirements_libreoffice_general_enabled">Impress Remote enabled at âTools â Options â LibreOffice Impress â Generalâ in LibreOffice Impress.</string> + <string name="requirements_libreoffice_experimental_enabled">Experimental features enabled at âTools â Options â LibreOffice â Advancedâ in LibreOffice Impress.</string> + <string name="requirements_network_connection">The Android device and a computer connected to the same network.</string> + <string name="requirements_network_ports">If you have a firewall make sure ports 1598 and 1599 are opened.</string> + <string name="requirements_bluetooth_connection">A computer with enabled Bluetooth.</string> + </resources> diff --git a/android/sdremote/res/values/styles.xml b/android/sdremote/res/values/styles.xml new file mode 100644 index 0000000..62aad2b --- /dev/null +++ b/android/sdremote/res/values/styles.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + + <style name="SectionHeader"> + <item name="android:textAllCaps">true</item> + <item name="android:textStyle">bold</item> + <item name="android:textColor">@color/background_header</item> + <item name="android:drawableBottom">@drawable/underline_header</item> + <item name="android:drawablePadding">@dimen/padding_header_underline</item> + <item name="android:paddingLeft">@dimen/padding_header</item> + <item name="android:paddingRight">@dimen/padding_header</item> + <item name="android:paddingTop">@dimen/padding_header</item> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">wrap_content</item> + </style> + + <style name="SectionItem"> + <item name="android:padding">@dimen/padding_section_item</item> + <item name="android:layout_width">fill_parent</item> + <item name="android:layout_height">wrap_content</item> + </style> + +</resources> \ No newline at end of file diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java index da4652a..bb82024 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java @@ -191,6 +191,10 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio callSettingsActivity(); return true; + case R.id.menu_requirements: + callRequirementsActivity(); + return true; + case R.id.menu_licenses: callLicensesActivity(); return true; @@ -205,6 +209,11 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio startActivity(aIntent); } + private void callRequirementsActivity() { + Intent aIntent = Intents.buildRequirementsIntent(this); + startActivity(aIntent); + } + private void callLicensesActivity() { Intent aIntent = Intents.buildLicensesIntent(this); startActivity(aIntent); diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java new file mode 100644 index 0000000..b99023d --- /dev/null +++ b/android/sdremote/src/org/libreoffice/impressremote/activity/RequirementsActivity.java @@ -0,0 +1,47 @@ +/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.libreoffice.impressremote.activity; + +import android.os.Bundle; + +import com.actionbarsherlock.app.SherlockActivity; +import com.actionbarsherlock.view.MenuItem; +import org.libreoffice.impressremote.R; + +public class RequirementsActivity extends SherlockActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_requirements); + + setUpHomeButton(); + } + + private void setUpHomeButton() { + getSupportActionBar().setHomeButtonEnabled(true); + } + + @Override + public boolean onOptionsItemSelected(MenuItem aMenuItem) { + switch (aMenuItem.getItemId()) { + case android.R.id.home: + navigateUp(); + return true; + + default: + return super.onOptionsItemSelected(aMenuItem); + } + } + + private void navigateUp() { + finish(); + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java index cdcec9a..20c56fb 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java +++ b/android/sdremote/src/org/libreoffice/impressremote/util/Intents.java @@ -14,6 +14,7 @@ import android.content.Intent; import org.libreoffice.impressremote.activity.ComputerConnectionActivity; import org.libreoffice.impressremote.activity.ComputerCreationActivity; import org.libreoffice.impressremote.activity.LicensesActivity; +import org.libreoffice.impressremote.activity.RequirementsActivity; import org.libreoffice.impressremote.activity.SettingsActivity; import org.libreoffice.impressremote.activity.SlideShowActivity; import org.libreoffice.impressremote.communication.CommunicationService; @@ -144,6 +145,10 @@ public final class Intents { return new Intent(aContext, SettingsActivity.class); } + public static Intent buildRequirementsIntent(Context aContext) { + return new Intent(aContext, RequirementsActivity.class); + } + public static Intent buildLicensesIntent(Context aContext) { return new Intent(aContext, LicensesActivity.class); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits