[Libreoffice-commits] core.git: 5 commits - android/sdremote

Artur Dryomov artur.dryomov at gmail.com
Fri Oct 25 05:43:29 PDT 2013


 android/sdremote/AndroidManifest.xml                                                  |    9 +++
 android/sdremote/res/layout/fragment_computers_list.xml                               |    9 +++
 android/sdremote/res/values/dimens.xml                                                |    1 
 android/sdremote/res/values/strings.xml                                               |    2 
 android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java    |   26 +++-------
 android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java    |    4 +
 android/sdremote/src/org/libreoffice/impressremote/adapter/ComputersPagerAdapter.java |    8 +--
 android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesGridAdapter.java     |    6 +-
 android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java    |   23 ++++++++
 android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java  |    4 +
 10 files changed, 67 insertions(+), 25 deletions(-)

New commits:
commit b5efef87efdce56c2491e6de1370ad42b998a8df
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Fri Oct 25 15:31:56 2013 +0300

    Change version to 2.0.0.
    
    Change-Id: Ic6ca04d61991afec627c7d76270c370233b0892f

diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index 0983450..80c4ed6 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -19,7 +19,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="org.libreoffice.impressremote"
           android:versionCode="8"
-          android:versionName="1.1"
+          android:versionName="2.0.0"
           android:installLocation="auto">
 
     <uses-permission
commit 53481041066e39d1309827fc7902228626c3a4c7
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Fri Oct 25 15:29:57 2013 +0300

    Fix possible NPE.
    
    Change-Id: Ifca1e64aacf0f4b4e83f70c9bcbe6bb79f5415fd

diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
index 1dbc22f..4d00217 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/SlideShowActivity.java
@@ -151,6 +151,10 @@ public class SlideShowActivity extends SherlockFragmentActivity implements Servi
     }
 
     private void startSlideShow() {
+        if (!isServiceBound()) {
+            return;
+        }
+
         if (mCommunicationService.getSlideShow().isRunning()) {
             setUpSlideShowInformation();
             return;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
index 19657cd..ea8c702 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
@@ -459,6 +459,10 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo
     }
 
     private void stopComputersSearch() {
+        if (!isServiceBound()) {
+            return;
+        }
+
         mCommunicationService.stopServersSearch();
     }
 
diff --git a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
index 4692977..a51b416 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/SlidesPagerFragment.java
@@ -119,6 +119,10 @@ public class SlidesPagerFragment extends SherlockFragment implements ServiceConn
     }
 
     private void setUpCurrentSlide() {
+        if (!isServiceBound()) {
+            return;
+        }
+
         SlideShow aSlideShow = mCommunicationService.getSlideShow();
 
         getSlidesPager().setCurrentItem(aSlideShow.getCurrentSlideIndex());
commit 16c53fb6aa50a8e433bced25d1361a6bcaeb51a8
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Fri Oct 25 15:24:02 2013 +0300

    Add "learn more" link for providing additional information.
    
    Change-Id: I3bb3480491d5f92ed7c4e3e6b5cf233636c4bb64

diff --git a/android/sdremote/AndroidManifest.xml b/android/sdremote/AndroidManifest.xml
index 82bf17e..0983450 100644
--- a/android/sdremote/AndroidManifest.xml
+++ b/android/sdremote/AndroidManifest.xml
@@ -78,6 +78,13 @@
         <activity
             android:name=".activity.RequirementsActivity"
             android:label="@string/title_requirements">
+
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW"/>
+                <data android:scheme="org.libreoffice.impressremote"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+            </intent-filter>
+
         </activity>
 
         <activity
diff --git a/android/sdremote/res/layout/fragment_computers_list.xml b/android/sdremote/res/layout/fragment_computers_list.xml
index 03bbbfe..edc7819 100644
--- a/android/sdremote/res/layout/fragment_computers_list.xml
+++ b/android/sdremote/res/layout/fragment_computers_list.xml
@@ -48,6 +48,15 @@
             android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
+        <TextView
+            android:id="@+id/text_learn_more"
+            android:text="@string/message_learn_more"
+            android:layout_gravity="center_horizontal"
+            android:visibility="invisible"
+            android:paddingTop="@dimen/padding_vertical_learn_more"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
     </LinearLayout>
 
     <ListView
diff --git a/android/sdremote/res/values/dimens.xml b/android/sdremote/res/values/dimens.xml
index 7e76175..82013fb 100644
--- a/android/sdremote/res/values/dimens.xml
+++ b/android/sdremote/res/values/dimens.xml
@@ -44,6 +44,7 @@
     <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="padding_vertical_learn_more">4dp</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 fb31b46..4ec816a 100644
--- a/android/sdremote/res/values/strings.xml
+++ b/android/sdremote/res/values/strings.xml
@@ -59,9 +59,9 @@
     <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="message_learn_more"><a href="org.libreoffice.impressremote://requirements/">Learn more</a></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/ComputersFragment.java b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
index 5527ea4..19657cd 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/fragment/ComputersFragment.java
@@ -23,7 +23,10 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.support.v4.content.LocalBroadcastManager;
+import android.text.Html;
 import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.text.util.Linkify;
 import android.view.ContextMenu;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -107,6 +110,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo
 
         if (aProgressMessageDisplayed) {
             showProgressMessage();
+            showLearnMoreMessage();
         }
     }
 
@@ -124,6 +128,20 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo
         return (TextView) getView().findViewById(R.id.text_progress_message);
     }
 
+    private void showLearnMoreMessage() {
+        TextView learnMoreView = getLearnMoreView();
+        Animation aFadeInAnimation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
+
+        learnMoreView.setMovementMethod(LinkMovementMethod.getInstance());
+
+        learnMoreView.startAnimation(aFadeInAnimation);
+        learnMoreView.setVisibility(View.VISIBLE);
+    }
+
+    private TextView getLearnMoreView() {
+        return (TextView) getView().findViewById(R.id.text_learn_more);
+    }
+
     private String getProgressMessage() {
         switch (getType()) {
             case WIFI:
@@ -238,6 +256,7 @@ public class ComputersFragment extends SherlockListFragment implements ServiceCo
         }
 
         showProgressMessage();
+        showLearnMoreMessage();
     }
 
     private boolean isShowingProgressMessageRequired() {
commit 2e605fcb12556dd65b0e5e4a0eac25b71182eb7b
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Sat Oct 19 03:45:59 2013 +0300

    Fix some comments and tabs positions.
    
    Change-Id: I6678d8142f7cbe2446b178174ffb36d446aeda11

diff --git a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
index 7ccd18e..043965a 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/activity/ComputersActivity.java
@@ -29,14 +29,6 @@ import org.libreoffice.impressremote.util.Preferences;
 import org.libreoffice.impressremote.util.SavedStates;
 
 public class ComputersActivity extends SherlockFragmentActivity implements ActionBar.TabListener, ViewPager.OnPageChangeListener {
-    private static final class TabsIndices {
-        private TabsIndices() {
-        }
-
-        public static final int BLUETOOTH = 0;
-        public static final int WIFI = 1;
-    }
-
     private boolean mBluetoothWasEnabled;
 
     @Override
@@ -52,9 +44,9 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
 
     private void saveBluetoothState(Bundle aSavedInstanceState) {
         // In more ideal world this work should be done at the service.
-        // Unfortunately service cannot save or restore its state
-        // but enabling or disabling Bluetooth is quite a long operation,
-        // so we have more chances to manage state right at the activity.
+        // Unfortunately service cannot save or restore its state.
+        // On other hand we should remember Bluetooth state exactly
+        // after the app’s start and pass it during recreation cycle.
 
         if (!BluetoothOperator.isAvailable()) {
             return;
@@ -78,7 +70,7 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
     private void setUpTitle() {
         // 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.
+        // to intents filter but it shows wrong label for recent apps screen then.
 
         ActionBar aActionBar = getSupportActionBar();
 
@@ -111,8 +103,10 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
     private void setUpTabs() {
         ActionBar aActionBar = getSupportActionBar();
 
-        aActionBar.addTab(buildActionBarTab(R.string.title_bluetooth), TabsIndices.BLUETOOTH);
-        aActionBar.addTab(buildActionBarTab(R.string.title_wifi), TabsIndices.WIFI);
+        aActionBar.addTab(buildActionBarTab(
+            R.string.title_bluetooth), ComputersPagerAdapter.PagesIndices.BLUETOOTH);
+        aActionBar.addTab(buildActionBarTab(
+            R.string.title_wifi), ComputersPagerAdapter.PagesIndices.WIFI);
     }
 
     private ActionBar.Tab buildActionBarTab(int aTitleResourceId) {
@@ -203,11 +197,11 @@ public class ComputersActivity extends SherlockFragmentActivity implements Actio
         MenuItem aComputerAddingMenuItem = aMenu.findItem(R.id.menu_add_computer);
 
         switch (getSupportActionBar().getSelectedNavigationIndex()) {
-            case TabsIndices.BLUETOOTH:
+            case ComputersPagerAdapter.PagesIndices.BLUETOOTH:
                 aComputerAddingMenuItem.setVisible(false);
                 break;
 
-            case TabsIndices.WIFI:
+            case ComputersPagerAdapter.PagesIndices.WIFI:
                 aComputerAddingMenuItem.setVisible(true);
 
             default:
diff --git a/android/sdremote/src/org/libreoffice/impressremote/adapter/ComputersPagerAdapter.java b/android/sdremote/src/org/libreoffice/impressremote/adapter/ComputersPagerAdapter.java
index 4a15ab3..f06a7f1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/adapter/ComputersPagerAdapter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/adapter/ComputersPagerAdapter.java
@@ -17,8 +17,8 @@ import org.libreoffice.impressremote.fragment.ComputersFragment;
 public class ComputersPagerAdapter extends FragmentPagerAdapter {
     private static final int PAGER_SIZE = 2;
 
-    private static final class PagerPositions {
-        private PagerPositions() {
+    public static final class PagesIndices {
+        private PagesIndices() {
         }
 
         public static final int BLUETOOTH = 0;
@@ -32,10 +32,10 @@ public class ComputersPagerAdapter extends FragmentPagerAdapter {
     @Override
     public Fragment getItem(int aPosition) {
         switch (aPosition) {
-            case PagerPositions.BLUETOOTH:
+            case PagesIndices.BLUETOOTH:
                 return ComputersFragment.newInstance(ComputersFragment.Type.BLUETOOTH);
 
-            case PagerPositions.WIFI:
+            case PagesIndices.WIFI:
                 return ComputersFragment.newInstance(ComputersFragment.Type.WIFI);
 
             default:
commit afabf78f5fb3ed2e24d1d8aeb7f9310141f1e8f5
Author: Artur Dryomov <artur.dryomov at gmail.com>
Date:   Sat Oct 19 03:44:49 2013 +0300

    Fix slides grid adapter: recycle view holder for better performance.
    
    Change-Id: Ia412c473ba1d5d23fc409b3f5513d87a4439ddfb

diff --git a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesGridAdapter.java b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesGridAdapter.java
index 7524dc4..19a5eea 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesGridAdapter.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/adapter/SlidesGridAdapter.java
@@ -73,11 +73,11 @@ public class SlidesGridAdapter extends BaseAdapter {
     }
 
     private ViewHolder getViewHolder(View aView) {
-        if (aView.getTag() != null) {
-            return (ViewHolder) aView.getTag();
+        if (aView.getTag() == null) {
+            aView.setTag(buildViewHolder(aView));
         }
 
-        return buildViewHolder(aView);
+        return (ViewHolder) aView.getTag();
     }
 
     private static final class ViewHolder {


More information about the Libreoffice-commits mailing list