diff options
3 files changed, 45 insertions, 60 deletions
diff --git a/android/sdremote/res/layout/fragment_slides_pager.xml b/android/sdremote/res/layout/fragment_slides_pager.xml index 18308a22b894..d572db07d0cf 100644 --- a/android/sdremote/res/layout/fragment_slides_pager.xml +++ b/android/sdremote/res/layout/fragment_slides_pager.xml @@ -13,59 +13,46 @@ android:layout_width="match_parent" android:layout_height="0dp"/> - <ViewAnimator - android:id="@+id/view_animator" - android:inAnimation="@android:anim/fade_in" - android:outAnimation="@android:anim/fade_out" + <LinearLayout + android:id="@+id/layout_notes" + android:orientation="vertical" + android:paddingLeft="@dimen/padding_slides_pager" + android:paddingRight="@dimen/padding_slides_pager" android:layout_weight="3" android:layout_width="match_parent" android:layout_height="0dp"> - <View - android:id="@+id/view_empty" - android:layout_width="match_parent" - android:layout_height="match_parent"/> - - <LinearLayout - android:id="@+id/layout_notes" - android:orientation="vertical" - android:paddingLeft="@dimen/padding_slides_pager" - android:paddingRight="@dimen/padding_slides_pager" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <TextView - style="@style/SectionHeader" - android:text="@string/header_notes" - android:paddingTop="@dimen/padding_header"/> - - <ScrollView - android:layout_width="wrap_content" + <TextView + style="@style/SectionHeader" + android:text="@string/header_notes" + android:paddingTop="@dimen/padding_header"/> + + <ScrollView + android:layout_width="wrap_content" + android:layout_height="wrap_content"> + + <TextSwitcher + android:id="@+id/text_switcher_notes" + android:inAnimation="@android:anim/fade_in" + android:outAnimation="@android:anim/fade_out" + android:paddingTop="@dimen/padding_slide_notes" + android:paddingLeft="@dimen/padding_slide_notes" + android:paddingRight="@dimen/padding_slide_notes" + android:layout_width="match_parent" android:layout_height="wrap_content"> - <TextSwitcher - android:id="@+id/text_switcher_notes" - android:inAnimation="@android:anim/fade_in" - android:outAnimation="@android:anim/fade_out" - android:paddingTop="@dimen/padding_slide_notes" - android:paddingLeft="@dimen/padding_slide_notes" - android:paddingRight="@dimen/padding_slide_notes" + <TextView android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content"/> - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - - </TextSwitcher> + <TextView + android:layout_width="match_parent" + android:layout_height="wrap_content"/> - </ScrollView> + </TextSwitcher> - </LinearLayout> + </ScrollView> - </ViewAnimator> + </LinearLayout> </LinearLayout> diff --git a/android/sdremote/res/values/strings.xml b/android/sdremote/res/values/strings.xml index 9fd81f9cd67b..0eefa954e179 100644 --- a/android/sdremote/res/values/strings.xml +++ b/android/sdremote/res/values/strings.xml @@ -43,6 +43,7 @@ <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="message_paused">Paused</string> + <string name="message_notes_empty">Nothing here.</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/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java index e3c921076d39..f8769f32ae38 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java +++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java @@ -21,12 +21,10 @@ import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.text.Html; import android.text.TextUtils; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextSwitcher; -import android.widget.ViewAnimator; import com.actionbarsherlock.app.SherlockFragment; import org.libreoffice.impressremote.communication.SlideShow; @@ -84,6 +82,7 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn aSlidesPager.setOnPageChangeListener(this); setUpCurrentSlide(); + setUpCurrentSlideNotes(); } private ViewPager getSlidesPager() { @@ -106,6 +105,12 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn getSlidesPager().setCurrentItem(aSlideShow.getCurrentSlideIndex()); } + private void setUpCurrentSlideNotes() { + SlideShow aSlideShow = mCommunicationService.getSlideShow(); + + setUpSlideNotes(aSlideShow.getCurrentSlideIndex()); + } + @Override public void onPageSelected(int aPosition) { mCommunicationService.getTransmitter().setCurrentSlide(aPosition); @@ -129,28 +134,20 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn } private void showSlideNotes(int aSlideIndex) { - ViewAnimator aViewAnimator = (ViewAnimator) getView().findViewById(R.id.view_animator); - ViewGroup aNotesLayout = (ViewGroup) getView().findViewById(R.id.layout_notes); - - if (aViewAnimator.getDisplayedChild() != aViewAnimator.indexOfChild(aNotesLayout)) { - aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aNotesLayout)); - } + TextSwitcher aSlideNotesSwitcher = getSlideNotesSwitcher(); + String aSlideNotes = mCommunicationService.getSlideShow().getSlideNotes(aSlideIndex); - setSlideNotes(aSlideIndex); + aSlideNotesSwitcher.setText(Html.fromHtml(aSlideNotes)); } - private void setSlideNotes(int aSlideIndex) { - TextSwitcher aSlideNotesTextSwitcher = (TextSwitcher) getView().findViewById(R.id.text_switcher_notes); - String aSlideNotes = mCommunicationService.getSlideShow().getSlideNotes(aSlideIndex); - - aSlideNotesTextSwitcher.setText(Html.fromHtml(aSlideNotes)); + private TextSwitcher getSlideNotesSwitcher() { + return (TextSwitcher) getView().findViewById(R.id.text_switcher_notes); } private void hideSlideNotes() { - ViewAnimator aViewAnimator = (ViewAnimator) getView().findViewById(R.id.view_animator); - View aEmptyView = getView().findViewById(R.id.view_empty); + TextSwitcher aSlideNotesSwitcher = getSlideNotesSwitcher(); - aViewAnimator.setDisplayedChild(aViewAnimator.indexOfChild(aEmptyView)); + aSlideNotesSwitcher.setText(getString(R.string.message_notes_empty)); } @Override |