summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2012-07-26 16:24:40 +0200
committerMichael Meeks <michael.meeks@suse.com>2012-08-06 10:23:04 +0100
commit148281ad8a6466b62055718f8f4071b43efa1408 (patch)
treedef156e44c0dd5be8ff09c27234fc95106466525 /android
parent6e2106cdfa83ed7d90dedd2c4f0f392d4865ab4f (diff)
Some cleanup on Presentation Fragment.
Change-Id: I I705b84c339303a77d4920cd601d4192ca9c23ea5
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java37
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java10
2 files changed, 9 insertions, 38 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
index 6bf3a0e078d4..b9c2091ea503 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationActivity.java
@@ -7,6 +7,7 @@ import java.util.TimeZone;
import org.libreoffice.impressremote.communication.CommunicationService;
import org.libreoffice.impressremote.communication.SlideShow.Timer;
+import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.Activity;
import android.app.FragmentManager;
@@ -43,26 +44,22 @@ public class PresentationActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_presentation);
bindService(new Intent(this, CommunicationService.class), mConnection,
Context.BIND_IMPORTANT);
+ mIsBound = true;
- FragmentManager fragmentManager = getFragmentManager();
- FragmentTransaction fragmentTransaction = fragmentManager
- .beginTransaction();
+ setContentView(R.layout.activity_presentation);
+ mLayout = (FrameLayout) findViewById(R.id.framelayout);
mThumbnailFragment = new ThumbnailFragment();
mPresentationFragment = new PresentationFragment();
- // fragmentTransaction.add(R.id.framelayout, mThumbnailFragment,
- // "fragment_thumbnail");
+ FragmentManager fragmentManager = getFragmentManager();
+ FragmentTransaction fragmentTransaction = fragmentManager
+ .beginTransaction();
fragmentTransaction.add(R.id.framelayout, mPresentationFragment,
"fragment_presentation");
fragmentTransaction.commit();
-
- mLayout = (FrameLayout) findViewById(R.id.framelayout);
-
- mIsBound = true;
}
@Override
@@ -94,22 +91,12 @@ public class PresentationActivity extends Activity {
final Messenger mMessenger = new Messenger(new MessageHandler());
+ @SuppressLint("HandlerLeak")
protected class MessageHandler extends Handler {
@Override
public void handleMessage(Message aMessage) {
mPresentationFragment.handleMessage(aMessage);
mThumbnailFragment.handleMessage(aMessage);
- // Bundle aData = aMessage.getData();
- // TODO: pass to fragments
- // switch (aMessage.what) {
- // case CommunicationService.MSG_SLIDE_CHANGED:
- // int aSlide = aData.getInt("slide_number");
- // break;
- // case CommunicationService.MSG_SLIDE_PREVIEW:
- // // int aNSlide = aData.getInt("slide_number");
- // break;
- //
- // }
}
}
@@ -149,13 +136,8 @@ public class PresentationActivity extends Activity {
public ActionBarManager() {
ActionBar aBar = getActionBar();
- // Set custom view and unset the title.
- aBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM,
- ActionBar.DISPLAY_SHOW_CUSTOM
- | ActionBar.DISPLAY_SHOW_TITLE);
aBar.setCustomView(R.layout.presentation_actionbar);
- // Set up the various components
mThumbnailButton = (ToggleButton) aBar.getCustomView()
.findViewById(R.id.actionbar_thumbnailtoggle);
mThumbnailButton.setOnClickListener(this);
@@ -166,10 +148,8 @@ public class PresentationActivity extends Activity {
setupClockBar();
- // Listen for fragment changes
getFragmentManager().addOnBackStackChangedListener(this);
- // Setup the auto updater
timerHandler.removeCallbacks(timerUpdateThread);
timerHandler.postDelayed(timerUpdateThread, 50);
@@ -385,7 +365,6 @@ public class PresentationActivity extends Activity {
} catch (ParseException e) {
}
}
- System.out.println("atime=" + aTime);
mCommunicationService.getSlideShow().getTimer()
.setCountdownTime(aTime);
return true;
diff --git a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
index 1793696681a3..7d9f36ab4b47 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/PresentationFragment.java
@@ -112,7 +112,6 @@ public class PresentationFragment extends Fragment {
// Calculate height change, taking limits into account
int aDiff = (int) (aEvent.getY());
- System.out.println("Diff1 is :" + aDiff);
if (aDiff + aHeight < DRAG_MARGIN) {
aDiff = DRAG_MARGIN - aHeight;
} else if ((aHeight + aDiff) > (aViewSize - DRAG_MARGIN)) {
@@ -125,7 +124,6 @@ public class PresentationFragment extends Fragment {
double aRatio = mOriginalCoverflowWidth
/ mOriginalCoverflowHeight;
- System.out.println("Diff2 is :" + aDiff);
float aHeightNew = mTopView.getImageHeight() + aDiff;
float aWidthNew = (float) (aRatio * aHeightNew);
@@ -136,12 +134,6 @@ public class PresentationFragment extends Fragment {
aDiff = (int) (aHeightNew - mTopView.getImageHeight());
}
- // Set the new settings -- it turns out that changing the
- // internal height now works, and changing the views height
- // is unnecessary / even causes problems.
- // aParams.height += aDiff;
- // mTopView.setLayoutParams(aParams);
-
mNewCoverflowHeight = aHeightNew;
mNewCoverflowWidth = aWidthNew;
@@ -150,7 +142,7 @@ public class PresentationFragment extends Fragment {
aAdapter.setWidth(aWidthNew);
mTopView.setImageWidth(aWidthNew);
- // We need to update the view now
+ // Force an update of the view
aAdapter.notifyDataSetChanged();
break;