[Libreoffice-commits] .: android/sdremote

Andrzej J.R. Hunt ajrhunt at kemper.freedesktop.org
Wed Aug 15 06:18:30 PDT 2012


 android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java  |   74 +++++-----
 android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java |   20 +-
 android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java |    2 
 android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java    |    2 
 4 files changed, 49 insertions(+), 49 deletions(-)

New commits:
commit edf69b5b3fbb94385a4f564aec6e3f54abe4ee32
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Wed Aug 15 15:06:08 2012 +0200

    Migrated to v4 support library fragments.
    
    Change-Id: I6db5d05e15cbe603327fc9f59e7b8cace343e36b

diff --git a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
index 4418431..2f0c8d1 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/BlankScreenFragment.java
@@ -2,13 +2,13 @@ package org.libreoffice.impressremote;
 
 import org.libreoffice.impressremote.communication.CommunicationService;
 
-import android.app.Fragment;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.RectF;
 import android.os.Bundle;
+import android.support.v4.app.Fragment;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -16,50 +16,50 @@ import android.widget.ImageView;
 
 public class BlankScreenFragment extends Fragment {
 
-	CommunicationService mCommunicationService;
+    CommunicationService mCommunicationService;
 
-	public BlankScreenFragment(CommunicationService aCommunicationService) {
-		mCommunicationService = aCommunicationService;
-	}
+    public BlankScreenFragment(CommunicationService aCommunicationService) {
+        mCommunicationService = aCommunicationService;
+    }
 
-	@Override
-	public View onCreateView(LayoutInflater inflater, ViewGroup container,
-	                Bundle savedInstanceState) {
+    @Override
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                    Bundle savedInstanceState) {
 
-		View v = inflater.inflate(R.layout.fragment_blankscreen, container,
-		                false);
+        View v = inflater.inflate(R.layout.fragment_blankscreen, container,
+                        false);
 
-		Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
-		                mCommunicationService.getSlideShow().getCurrentSlide());
+        Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
+                        mCommunicationService.getSlideShow().getCurrentSlide());
 
-		// Process the image
-		final int borderWidth = 8;
+        // Process the image
+        final int borderWidth = 8;
 
-		Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
-		p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
+        Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
+        p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
 
-		RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
-		                + aBitmap.getWidth(), borderWidth + aBitmap.getHeight());
-		Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 * borderWidth,
-		                aBitmap.getHeight() + 2 * borderWidth,
-		                aBitmap.getConfig());
-		Canvas canvas = new Canvas(aOut);
-		canvas.drawColor(Color.TRANSPARENT);
-		canvas.drawRect(aRect, p);
-		canvas.drawBitmap(aBitmap, null, aRect, null);
+        RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
+                        + aBitmap.getWidth(), borderWidth + aBitmap.getHeight());
+        Bitmap aOut = Bitmap.createBitmap(aBitmap.getWidth() + 2 * borderWidth,
+                        aBitmap.getHeight() + 2 * borderWidth,
+                        aBitmap.getConfig());
+        Canvas canvas = new Canvas(aOut);
+        canvas.drawColor(Color.TRANSPARENT);
+        canvas.drawRect(aRect, p);
+        canvas.drawBitmap(aBitmap, null, aRect, null);
 
-		ImageView aImage = (ImageView) v
-		                .findViewById(R.id.blankscreen_slidepreview);
-		aImage.setImageBitmap(aOut);
+        ImageView aImage = (ImageView) v
+                        .findViewById(R.id.blankscreen_slidepreview);
+        aImage.setImageBitmap(aOut);
 
-		mCommunicationService.getTransmitter().blankScreen();
-		// TODO Auto-generated method stub
-		return v;
-	}
+        mCommunicationService.getTransmitter().blankScreen();
+        // TODO Auto-generated method stub
+        return v;
+    }
 
-	@Override
-	public void onDestroyView() {
-		super.onDestroyView();
-		mCommunicationService.getTransmitter().resume();
-	}
+    @Override
+    public void onDestroyView() {
+        super.onDestroyView();
+        mCommunicationService.getTransmitter().resume();
+    }
 }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 912059d..bc4efa9 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -8,9 +8,6 @@ import org.libreoffice.impressremote.communication.CommunicationService;
 import org.libreoffice.impressremote.communication.SlideShow.Timer;
 
 import android.app.ActionBar;
-import android.app.Activity;
-import android.app.FragmentManager;
-import android.app.FragmentTransaction;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -20,6 +17,9 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.IBinder;
 import android.preference.PreferenceManager;
+import android.support.v4.app.FragmentActivity;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
 import android.text.format.DateFormat;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -34,7 +34,7 @@ import android.widget.FrameLayout;
 import android.widget.TextView;
 import android.widget.ToggleButton;
 
-public class PresentationActivity extends Activity {
+public class PresentationActivity extends FragmentActivity {
     private CommunicationService mCommunicationService;
     private boolean mIsBound = false;
     private FrameLayout mLayout;
@@ -62,7 +62,7 @@ public class PresentationActivity extends Activity {
         mThumbnailFragment = new ThumbnailFragment();
         mPresentationFragment = new PresentationFragment();
 
-        FragmentManager fragmentManager = getFragmentManager();
+        FragmentManager fragmentManager = getSupportFragmentManager();
         FragmentTransaction fragmentTransaction = fragmentManager
                         .beginTransaction();
         fragmentTransaction.add(R.id.presentation_innerFrame,
@@ -149,7 +149,7 @@ public class PresentationActivity extends Activity {
                 BlankScreenFragment aFragment = new BlankScreenFragment(
                                 mCommunicationService);
 
-                FragmentTransaction ft = getFragmentManager()
+                FragmentTransaction ft = getSupportFragmentManager()
                                 .beginTransaction();
                 ft.replace(R.id.presentation_innerFrame, aFragment);
                 ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
@@ -220,7 +220,7 @@ public class PresentationActivity extends Activity {
 
             setupClockBar();
 
-            getFragmentManager().addOnBackStackChangedListener(this);
+            getSupportFragmentManager().addOnBackStackChangedListener(this);
 
             timerHandler.removeCallbacks(timerUpdateThread);
             timerHandler.postDelayed(timerUpdateThread, 50);
@@ -356,14 +356,14 @@ public class PresentationActivity extends Activity {
             // --------------------------------- ACTIONBAR BUTTONS -------------
             if (aSource == mThumbnailButton) {
                 if (!mThumbnailFragment.isVisible()) {
-                    FragmentTransaction ft = getFragmentManager()
+                    FragmentTransaction ft = getSupportFragmentManager()
                                     .beginTransaction();
                     ft.replace(R.id.presentation_innerFrame, mThumbnailFragment);
                     ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
                     ft.addToBackStack(null);
                     ft.commit();
                 } else {
-                    getFragmentManager().popBackStack();
+                    getSupportFragmentManager().popBackStack();
                 }
             } else if (aSource == mTimeLabel) {
                 if (mClockBar.getVisibility() == View.VISIBLE) {
@@ -422,7 +422,7 @@ public class PresentationActivity extends Activity {
 
         @Override
         public void onBackStackChanged() {
-            if (getFragmentManager().getBackStackEntryCount() == 0) {
+            if (getSupportFragmentManager().getBackStackEntryCount() == 0) {
                 mThumbnailButton.setChecked(false);
             }
         }
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 69201a1..27d0f7e 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -5,7 +5,6 @@ import org.libreoffice.impressremote.communication.SlideShow;
 
 import pl.polidea.coverflow.AbstractCoverFlowImageAdapter;
 import pl.polidea.coverflow.CoverFlow;
-import android.app.Fragment;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -17,6 +16,7 @@ import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.RectF;
 import android.os.Bundle;
+import android.support.v4.app.Fragment;
 import android.support.v4.content.LocalBroadcastManager;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
index 4dbcaff..b909fa7 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/ThumbnailFragment.java
@@ -11,7 +11,6 @@ package org.libreoffice.impressremote;
 import org.libreoffice.impressremote.communication.CommunicationService;
 import org.libreoffice.impressremote.communication.SlideShow;
 
-import android.app.Fragment;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -19,6 +18,7 @@ import android.content.IntentFilter;
 import android.graphics.Bitmap;
 import android.graphics.Typeface;
 import android.os.Bundle;
+import android.support.v4.app.Fragment;
 import android.support.v4.content.LocalBroadcastManager;
 import android.view.LayoutInflater;
 import android.view.View;


More information about the Libreoffice-commits mailing list