App
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
mhr.app.AppMainActivity Class Reference

Hlavní třída, spouští aplikaci a představuje její UI. More...

Inheritance diagram for mhr.app.AppMainActivity:

Classes

class  ExceptionFeedback
 Zpětná vazba při výjimce. More...
 
class  RendererEH
 Exception Handler pro renderovací vlákno. More...
 
class  UIEH
 Exception Handler pro UI vlákno. Vypíše chybové hlášení do souboru. More...
 
class  UnblockException
 Listener pro odblokování UI. More...
 
class  WorkerEH
 Exception Handler pro pracovní vlákno. More...
 

Public Member Functions

LayersPaneFragment getLayersPane ()
 Vrátí fragment panelu vrstev.
 
BitmapDisplayer getBitmapDisplayer ()
 Vrátí displayer, který vykresluje výstup.
 
AppCore getAppCore ()
 vrátí jádro aplikace
 
void addCommand (AppCommand cmd)
 odešle příkaz jádru aplikace.
 
void setCanvasOnTouchListener (OnTouchListener listener)
 Nastaví posluchače událostí plátna.
 
void showDialog (Fragment dialog)
 Zobrazí dialog přes plátno.
 
void dismissDialog ()
 Skryje dialog zobrazený přes plátno.
 
void showProgressBar ()
 Zablokuje UI aplikace a zobrazí progressBar.
 
void hideProgressBar ()
 Odblokuje UI aplikace a skryje progressBar.
 
FrameLayout getGuiOverCanvas ()
 Vrátí FrameLayout, který lze použít pro zobrazení UI přes výstup dispalyeru.
 
void onExceptionFeedback (Exception e)
 Akce, který se vykoná po nefatální výjímce jádra.
 
String getPath (Uri uri)
 převede URI na fyzickou adresu obrázku.
 
void onBackPressed ()
 

Static Public Attributes

static final int OPEN_IMAGE_FROM_GALLERY_REQUEST_CODE = 1001
 

Protected Member Functions

void onActivityResult (int requestCode, int resultCode, Intent data)
 
void onCreate (Bundle savedInstanceState)
 
void onRestart ()
 
void onStart ()
 
void onResume ()
 
void onPause ()
 
void onStop ()
 
void onDestroy ()
 

Protected Attributes

BitmapDisplayer disp
 
AppCore app
 
ToolBoxPaneFragment toolBoxPane
 Fragment představující toolbox.
 
LayersPaneFragment layersPane
 Fragment představující vrstvy.
 
Fragment dialog
 Fragment, který představuje aktuálně zobrazený dialog nad plátnem.
 
View dialogPlaceholder
 View, které je v případě potřeby nahrazeno dialogem nad plátnem.
 
View progressBarOverlay
 View, které v případě zobrazení zablokuje celé UI a zobrazí progressBar.
 
SurfaceView canvas
 
FrameLayout guiOverCanvas
 
boolean invalidScreen = false
 

Detailed Description

Hlavní třída, spouští aplikaci a představuje její UI.

Definition at line 49 of file AppMainActivity.java.

Member Function Documentation

void mhr.app.AppMainActivity.addCommand ( AppCommand  cmd)
inline

odešle příkaz jádru aplikace.

Parameters
cmd

Definition at line 262 of file AppMainActivity.java.

{
}
void mhr.app.AppMainActivity.dismissDialog ( )
inline

Skryje dialog zobrazený přes plátno.

Definition at line 288 of file AppMainActivity.java.

{
if (dialog != null) {
getFragmentManager().beginTransaction().remove(dialog).commit();
dialogPlaceholder.setVisibility(View.GONE);
dialog = null;
}
}
AppCore mhr.app.AppMainActivity.getAppCore ( )
inline

vrátí jádro aplikace

Returns

Definition at line 254 of file AppMainActivity.java.

{
return app;
}
BitmapDisplayer mhr.app.AppMainActivity.getBitmapDisplayer ( )
inline

Vrátí displayer, který vykresluje výstup.

Returns

Definition at line 246 of file AppMainActivity.java.

{
return disp;
}
FrameLayout mhr.app.AppMainActivity.getGuiOverCanvas ( )
inline

Vrátí FrameLayout, který lze použít pro zobrazení UI přes výstup dispalyeru.

Returns

Definition at line 314 of file AppMainActivity.java.

{
return guiOverCanvas;
}
LayersPaneFragment mhr.app.AppMainActivity.getLayersPane ( )
inline

Vrátí fragment panelu vrstev.

Returns

Definition at line 238 of file AppMainActivity.java.

{
return layersPane;
}
String mhr.app.AppMainActivity.getPath ( Uri  uri)
inline

převede URI na fyzickou adresu obrázku.

Parameters
uri
Returns

Definition at line 338 of file AppMainActivity.java.

{
String[] projection = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(uri, projection, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
void mhr.app.AppMainActivity.hideProgressBar ( )
inline

Odblokuje UI aplikace a skryje progressBar.

Definition at line 306 of file AppMainActivity.java.

{
progressBarOverlay.setVisibility(View.GONE);
}
void mhr.app.AppMainActivity.onActivityResult ( int  requestCode,
int  resultCode,
Intent  data 
)
inlineprotected

Definition at line 348 of file AppMainActivity.java.

{
String filePath = null;
String realPath = null;
File imgFile = null;
switch (requestCode) {
if (resultCode == RESULT_OK && data != null && data.getData() != null) {
filePath = data.getData().getPath();
imgFile = new File(filePath);
if (!imgFile.exists()) {
realPath = this.getPath(data.getData()); // TOTO je správný postup, ale některé programy jako Astro jej nedodržují a vrací reálnou cestu
imgFile = new File(realPath);
}
if (imgFile.exists()) {
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
app.openImage(new APDBitmap(myBitmap));
}
}
}
}
void mhr.app.AppMainActivity.onBackPressed ( )
inline

Definition at line 371 of file AppMainActivity.java.

{
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle("Exit").setMessage("Dou you really want to exit?");
b.setNegativeButton("No", null);
b.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AppMainActivity.this.finish();
}
});
b.create().show();
}
void mhr.app.AppMainActivity.onCreate ( Bundle  savedInstanceState)
inlineprotected

Definition at line 389 of file AppMainActivity.java.

{
super.onCreate(savedInstanceState);
/*
* Called when the activity is first created. This is where you should do all of your normal static set up: create views, bind data to lists, etc.
* This method also provides you with a Bundle containing the activity's previously frozen state, if there was one. Always followed by onStart().
*
* NOT KILLABlE
*/
setContentView(R.layout.activity_app_main);
if (findViewById(R.id.ErrorMessage) != null) {
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.setTitle("ERROR").setMessage("Only 10'' screens are currently supported.");
b.setCancelable(false);
b.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
AppMainActivity.this.finish();
}
});
b.create().show();
invalidScreen = true;
return;
}
Thread.setDefaultUncaughtExceptionHandler(new UIEH());
dialogPlaceholder = findViewById(R.id.DialogPlaceholder);
progressBarOverlay = findViewById(R.id.ProgressBarOverlay);
guiOverCanvas = (FrameLayout) findViewById(R.id.GuiOverCanvasPlaceholder);
canvas = (SurfaceView) findViewById(R.id.DrawingCanvas);
disp = new BitmapDisplayer(canvas);
toolBoxPane = new ToolBoxPaneFragment();
layersPane = new LayersPaneFragment();
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.LeftStrip, toolBoxPane);
ft.replace(R.id.RightStrip, layersPane);
ft.commit();
app = new AppCore(disp);
app.setExceptionFeedback(new ExceptionFeedback());
Bitmap initBitmap = Bitmap.createBitmap(640, 480, Bitmap.Config.ARGB_8888);
Canvas canv = new Canvas(initBitmap);
canv.drawColor(0xFFFFFFFF);
app.openImage(new APDBitmap(initBitmap));
app.setWorkingThreadEH(new WorkerEH());
app.setRenderingThreadEH(new RendererEH());
}
void mhr.app.AppMainActivity.onDestroy ( )
inlineprotected

Definition at line 525 of file AppMainActivity.java.

{
super.onDestroy();
return;
}
/*
* The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it,
* or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the
* isFinishing() method.
*
* KILLABLE
*/
}
void mhr.app.AppMainActivity.onExceptionFeedback ( Exception  e)
inline

Akce, který se vykoná po nefatální výjímce jádra.

Parameters
e

Definition at line 322 of file AppMainActivity.java.

{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Non-fatal exception occured")
.setIconAttribute(android.R.attr.alertDialogIcon)
.setMessage(e.getMessage())
.setCancelable(false)
.setPositiveButton("Continue", new UnblockException());
AlertDialog alert = builder.create();
alert.show();
}
void mhr.app.AppMainActivity.onPause ( )
inlineprotected

Definition at line 492 of file AppMainActivity.java.

{
super.onPause();
return;
}
/*
* Called when the system is about to start resuming a previous activity. This is typically used to commit unsaved changes to persistent data,
* stop animations and other things that may be consuming CPU, etc. Implementations of this method must be very quick because the next activity
* will not be resumed until this method returns. Followed by either onResume() if the activity returns back to the front, or onStop() if it
* becomes invisible to the user.
*
* NOT KILLABLE
*/
}
void mhr.app.AppMainActivity.onRestart ( )
inlineprotected

Definition at line 446 of file AppMainActivity.java.

{
super.onRestart();
return;
}
/*
* Called after your activity has been stopped, prior to it being started again. Always followed by onStart()
*
* NOT KILLABLE
*/
}
void mhr.app.AppMainActivity.onResume ( )
inlineprotected

Definition at line 474 of file AppMainActivity.java.

{
super.onResume();
return;
}
/*
* Called when the activity will start interacting with the user. At this point your activity is at the top of the activity stack,
* with user input going to it. Always followed by onPause().
*
* NOT KILLABLE
*/
// layersPane.updateLayers();
}
void mhr.app.AppMainActivity.onStart ( )
inlineprotected

Definition at line 459 of file AppMainActivity.java.

{
super.onStart();
return;
}
/*
* Called when the activity is becoming visible to the user. Followed by onResume() if the activity comes to the foreground,
* or onStop() if it becomes hidden.
*
* NOT KILLABLE
*/
}
void mhr.app.AppMainActivity.onStop ( )
inlineprotected

Definition at line 509 of file AppMainActivity.java.

{
super.onStop();
return;
}
/*
* Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one. This may happen
* either because a new activity is being started, an existing one is being brought in front of this one, or this one is being destroyed. Followed
* by either onRestart() if this activity is coming back to interact with the user, or onDestroy() if this activity is going away.
*
* KILLABLE
*/
}
void mhr.app.AppMainActivity.setCanvasOnTouchListener ( OnTouchListener  listener)
inline

Nastaví posluchače událostí plátna.

Parameters
listener

Definition at line 270 of file AppMainActivity.java.

{
canvas.setOnTouchListener(listener);
}
void mhr.app.AppMainActivity.showDialog ( Fragment  dialog)
inline

Zobrazí dialog přes plátno.

Parameters
dialog

Definition at line 278 of file AppMainActivity.java.

{
this.dialog = dialog;
dialogPlaceholder.setVisibility(View.VISIBLE);
getFragmentManager().beginTransaction().replace(R.id.DialogPlaceholder, dialog).commit();
}
void mhr.app.AppMainActivity.showProgressBar ( )
inline

Zablokuje UI aplikace a zobrazí progressBar.

Definition at line 299 of file AppMainActivity.java.

{
progressBarOverlay.setVisibility(View.VISIBLE);
}

Member Data Documentation

AppCore mhr.app.AppMainActivity.app
protected

Definition at line 211 of file AppMainActivity.java.

SurfaceView mhr.app.AppMainActivity.canvas
protected

Definition at line 218 of file AppMainActivity.java.

Fragment mhr.app.AppMainActivity.dialog
protected

Fragment, který představuje aktuálně zobrazený dialog nad plátnem.

Definition at line 215 of file AppMainActivity.java.

View mhr.app.AppMainActivity.dialogPlaceholder
protected

View, které je v případě potřeby nahrazeno dialogem nad plátnem.

Definition at line 216 of file AppMainActivity.java.

BitmapDisplayer mhr.app.AppMainActivity.disp
protected

Definition at line 210 of file AppMainActivity.java.

FrameLayout mhr.app.AppMainActivity.guiOverCanvas
protected

Definition at line 219 of file AppMainActivity.java.

boolean mhr.app.AppMainActivity.invalidScreen = false
protected

Definition at line 221 of file AppMainActivity.java.

LayersPaneFragment mhr.app.AppMainActivity.layersPane
protected

Fragment představující vrstvy.

Definition at line 214 of file AppMainActivity.java.

final int mhr.app.AppMainActivity.OPEN_IMAGE_FROM_GALLERY_REQUEST_CODE = 1001
static

Definition at line 224 of file AppMainActivity.java.

View mhr.app.AppMainActivity.progressBarOverlay
protected

View, které v případě zobrazení zablokuje celé UI a zobrazí progressBar.

Definition at line 217 of file AppMainActivity.java.

ToolBoxPaneFragment mhr.app.AppMainActivity.toolBoxPane
protected

Fragment představující toolbox.

Definition at line 213 of file AppMainActivity.java.


The documentation for this class was generated from the following file: