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
This commit is contained in:
@@ -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"/>
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
android:text="@string/header_notes"
|
||||
android:paddingTop="@dimen/padding_header"/>
|
||||
|
||||
<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">
|
||||
<ScrollView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
style="@style/SectionHeader"
|
||||
android:text="@string/header_notes"
|
||||
android:paddingTop="@dimen/padding_header"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="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"/>
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</TextSwitcher>
|
||||
</TextSwitcher>
|
||||
|
||||
</ScrollView>
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ViewAnimator>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -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>
|
||||
|
@@ -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));
|
||||
}
|
||||
|
||||
setSlideNotes(aSlideIndex);
|
||||
}
|
||||
|
||||
private void setSlideNotes(int aSlideIndex) {
|
||||
TextSwitcher aSlideNotesTextSwitcher = (TextSwitcher) getView().findViewById(R.id.text_switcher_notes);
|
||||
TextSwitcher aSlideNotesSwitcher = getSlideNotesSwitcher();
|
||||
String aSlideNotes = mCommunicationService.getSlideShow().getSlideNotes(aSlideIndex);
|
||||
|
||||
aSlideNotesTextSwitcher.setText(Html.fromHtml(aSlideNotes));
|
||||
aSlideNotesSwitcher.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
|
||||
|
Reference in New Issue
Block a user