Blank screen view showing.
Change-Id: Ica6b740029bb1eb7d55dedec189c944af0027566
This commit is contained in:
committed by
Michael Meeks
parent
0ce7b3e9f1
commit
f4bd348566
@@ -1,7 +1,52 @@
|
||||
package org.libreoffice.impressremote;
|
||||
|
||||
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.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
public class BlankScreenFragment extends Fragment {
|
||||
|
||||
Bitmap mBitmap;
|
||||
|
||||
public BlankScreenFragment(Bitmap aBitmap) {
|
||||
mBitmap = aBitmap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
View v = inflater.inflate(R.layout.fragment_blankscreen, container,
|
||||
false);
|
||||
|
||||
// Process the image
|
||||
final int borderWidth = 8;
|
||||
|
||||
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
p.setShadowLayer(borderWidth, 0, 0, Color.BLACK);
|
||||
|
||||
RectF aRect = new RectF(borderWidth, borderWidth, borderWidth
|
||||
+ mBitmap.getWidth(), borderWidth + mBitmap.getHeight());
|
||||
Bitmap aOut = Bitmap.createBitmap(mBitmap.getWidth() + 2 * borderWidth,
|
||||
mBitmap.getHeight() + 2 * borderWidth,
|
||||
mBitmap.getConfig());
|
||||
Canvas canvas = new Canvas(aOut);
|
||||
canvas.drawColor(Color.TRANSPARENT);
|
||||
canvas.drawRect(aRect, p);
|
||||
canvas.drawBitmap(mBitmap, null, aRect, null);
|
||||
|
||||
ImageView aImage = (ImageView) v
|
||||
.findViewById(R.id.blankscreen_slidepreview);
|
||||
aImage.setImageBitmap(aOut);
|
||||
// TODO Auto-generated method stub
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
@@ -143,15 +144,27 @@ public class PresentationActivity extends Activity {
|
||||
Intent aIntent;
|
||||
switch (item.getItemId()) {
|
||||
case R.id.actionbar_presentation_submenu_options:
|
||||
// FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
// ft.replace(R.id.presentation_innerFrame, new SettingsFragment());
|
||||
// ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||
// ft.addToBackStack(null);
|
||||
// ft.commit();
|
||||
|
||||
aIntent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(aIntent);
|
||||
return true;
|
||||
case R.id.actionbar_presentation_submenu_blank:
|
||||
boolean aRelevantFragmentVisible = mPresentationFragment
|
||||
.isVisible() || mThumbnailFragment.isVisible();
|
||||
if (aRelevantFragmentVisible) {
|
||||
Bitmap aBitmap = mCommunicationService.getSlideShow().getImage(
|
||||
mCommunicationService.getSlideShow()
|
||||
.getCurrentSlide());
|
||||
|
||||
BlankScreenFragment aFragment = new BlankScreenFragment(aBitmap);
|
||||
|
||||
FragmentTransaction ft = getFragmentManager()
|
||||
.beginTransaction();
|
||||
ft.replace(R.id.presentation_innerFrame, aFragment);
|
||||
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
||||
ft.addToBackStack(null);
|
||||
ft.commit();
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
Reference in New Issue
Block a user