summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-09-10 12:24:19 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-09-11 01:43:52 +0300
commit54433a11e711a440f698c94edcd22379222db1ce (patch)
treec12325790a4018e79df0a466fc45a9cc33d7e50a /android
parent2dfaabc1bab1cf20110e984010c96a5b94973db8 (diff)
Remove hiding notes section when there are no notes.
Show warning instead. This change should help avoiding users confusing when they see half of the screen empty without any reason. Change-Id: Ic229e80fc56a9ad8a419dc19b0784213b1fe3a68
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/res/layout/fragment_slides_pager.xml73
-rw-r--r--android/sdremote/res/values/strings.xml1
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java31
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