Skip to content

Commit

Permalink
Offer Assisi overlay publicly.
Browse files Browse the repository at this point in the history
Use Activity.runOnUiThread in EyeImageView to resolve issues with quick
loading
  • Loading branch information
Joerg authored and Joerg committed Feb 22, 2014
1 parent b30077f commit 5ac9028
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 37 deletions.
5 changes: 0 additions & 5 deletions Augendiagnose/res/drawable/circle.xml

This file was deleted.

1 change: 0 additions & 1 deletion Augendiagnose/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<string name="button_switch">Tauschen</string>
<string name="button_other_pictures">Andere Fotos</string>

<string name="toggle_overlay_circle">Kreis</string>
<string name="toggle_overlay_1">IT 1</string>
<string name="toggle_overlay_2">IT 2</string>
<string name="toggle_overlay_3">IT 3</string>
Expand Down
2 changes: 1 addition & 1 deletion Augendiagnose/res/values-de/strings_releasenotes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Kamera benutzen. Bitte informieren Sie mich, wenn solche Probleme auftreten.</p>
<item>Neues Overlay. Verbessertes Zooming des Overlays. Verbesserte Darstellung.</item>
<item>Hilfeseiten für die wichtigsten Aktivitäten hinzugefügt.</item>
<item>Die Overlay-Position wird in den Bilddateien gespeichert.</item>
<item>Ein weiteres (italienisches) Overlay. Bugfixes.</item>
<item>Ein weiteres (italienisches) Overlay. Startinformation für neue Nutzer. Bugfixes.</item>
</string-array>

</resources>
1 change: 0 additions & 1 deletion Augendiagnose/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<string name="button_switch">Switch</string>
<string name="button_other_pictures">Other Pictures</string>

<string name="toggle_overlay_circle">Circle</string>
<string name="toggle_overlay_1">IT 1</string>
<string name="toggle_overlay_2">IT 2</string>
<string name="toggle_overlay_3">IT 3</string>
Expand Down
2 changes: 1 addition & 1 deletion Augendiagnose/res/values/strings_releasenotes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ when using the app for the first time with a new device or with a new camera. Pl
<item>Added a second custom overlay. Improved overlay pinching. Corrected some display issues.</item>
<item>Added various help screens.</item>
<item>Enabled storage of Overlay position within JPG file.</item>
<item>Added one more (Italian) overlay. Bugfixes.</item>
<item>Added one more (Italian) overlay. Added start screen for new users. Bugfixes.</item>
</string-array>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ protected void onCreate(Bundle savedInstanceState) {
imageView.mLockButton = (ToggleButton) findViewById(R.id.toggleButtonLink);

if (!Application.isAuthorized()) {
toggleOverlayButtons[3].setEnabled(false);
toggleOverlayButtons[3].setVisibility(View.GONE);
toggleOverlayButtons[4].setEnabled(false);
toggleOverlayButtons[4].setVisibility(View.GONE);
toggleOverlayButtons[5].setEnabled(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.eisfeldj.augendiagnose.components;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
Expand Down Expand Up @@ -30,14 +31,14 @@ public EyeImageView(Context context, AttributeSet attrs, int defStyle) {
*
* @param eyePhoto
*/
public void setEyePhoto(final EyePhoto eyePhoto, final Runnable postActivities) {
public void setEyePhoto(final Activity activity, final EyePhoto eyePhoto, final Runnable postActivities) {
this.eyePhoto = eyePhoto;
// Fill pictures in separate thread, for performance reasons
new Thread() {
@Override
public void run() {
eyePhoto.precalculateImageBitmap(MediaStoreUtil.MINI_THUMB_SIZE);
post(new Runnable() {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
setImageBitmap(eyePhoto.getImageBitmap(MediaStoreUtil.MINI_THUMB_SIZE));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.eisfeldj.augendiagnose.components;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -14,8 +15,8 @@
*/
public class ListPicturesForNameArrayAdapter extends ListPicturesForNameBaseArrayAdapter {

public ListPicturesForNameArrayAdapter(Context context, EyePhotoPair[] eyePhotoPairs) {
super(context, eyePhotoPairs);
public ListPicturesForNameArrayAdapter(Activity activity, EyePhotoPair[] eyePhotoPairs) {
super(activity, eyePhotoPairs);
}

public ListPicturesForNameArrayAdapter(Context context) {
Expand Down Expand Up @@ -44,7 +45,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
@Override
public void onClick(View v) {
ImageSelectionAndDisplayHandler.getInstance().cleanSelectedView();
DisplayTwoActivity.startActivity(ListPicturesForNameArrayAdapter.this.context, eyePhotoPairs[position]
DisplayTwoActivity.startActivity(ListPicturesForNameArrayAdapter.this.activity, eyePhotoPairs[position]
.getRightEye().getAbsolutePath(), eyePhotoPairs[position].getLeftEye().getAbsolutePath());

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.eisfeldj.augendiagnose.components;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -13,7 +14,7 @@
* Array adapter class to display an eye photo pair in a list.
*/
public abstract class ListPicturesForNameBaseArrayAdapter extends ArrayAdapter<EyePhotoPair> {
protected final Context context;
protected final Activity activity;

/**
* Keep up to 25 rows in memory before reusing views.
Expand All @@ -22,15 +23,15 @@ public abstract class ListPicturesForNameBaseArrayAdapter extends ArrayAdapter<E

protected EyePhotoPair[] eyePhotoPairs;

public ListPicturesForNameBaseArrayAdapter(Context context, EyePhotoPair[] eyePhotoPairs) {
super(context, R.layout.text_view_initializing, eyePhotoPairs);
this.context = context;
public ListPicturesForNameBaseArrayAdapter(Activity activity, EyePhotoPair[] eyePhotoPairs) {
super(activity, R.layout.text_view_initializing, eyePhotoPairs);
this.activity = activity;
this.eyePhotoPairs = eyePhotoPairs;
}

public ListPicturesForNameBaseArrayAdapter(Context context) {
super(context, R.layout.adapter_list_pictures_for_name);
this.context = context;
this.activity = (Activity) context;
}

/**
Expand Down Expand Up @@ -59,7 +60,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
rowView = convertView;
}
else {
rowView = LayoutInflater.from(context).inflate(getLayout(), parent, false);
rowView = LayoutInflater.from(activity).inflate(getLayout(), parent, false);
cacheRange.putIntoRange(position);
}

Expand All @@ -71,7 +72,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
if (!imageListRight.isInitialized()) {
// Prevent duplicate initialization in case of multiple parallel calls - will happen in dialog
imageListRight.setInitialized();
imageListRight.setEyePhoto(eyePhotoPairs[position].getRightEye(), new Runnable() {
imageListRight.setEyePhoto(activity, eyePhotoPairs[position].getRightEye(), new Runnable() {
@Override
public void run() {
prepareViewForSelection(imageListRight);
Expand All @@ -81,7 +82,7 @@ public void run() {
final EyeImageView imageListLeft = (EyeImageView) rowView.findViewById(R.id.imageListLeft);
if (!imageListLeft.isInitialized()) {
imageListLeft.setInitialized();
imageListLeft.setEyePhoto(eyePhotoPairs[position].getLeftEye(), new Runnable() {
imageListLeft.setEyePhoto(activity, eyePhotoPairs[position].getLeftEye(), new Runnable() {
@Override
public void run() {
prepareViewForSelection(imageListLeft);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,28 +306,28 @@ private Drawable getOverlayDrawable(int position) {
break;
case 3:
if (mEyePhoto.getRightLeft().equals(RightLeft.RIGHT)) {
resource = R.drawable.overlay_topo3_r;
resource = R.drawable.overlay_topo5_r;
}
else {
resource = R.drawable.overlay_topo3_l;
resource = R.drawable.overlay_topo5_l;
}
overlayCache[position] = getColouredDrawable(resource, OVERLAY_COLOR);
break;
case 4:
if (mEyePhoto.getRightLeft().equals(RightLeft.RIGHT)) {
resource = R.drawable.overlay_topo4_r;
resource = R.drawable.overlay_topo3_r;
}
else {
resource = R.drawable.overlay_topo4_l;
resource = R.drawable.overlay_topo3_l;
}
overlayCache[position] = getColouredDrawable(resource, OVERLAY_COLOR);
break;
case 5:
if (mEyePhoto.getRightLeft().equals(RightLeft.RIGHT)) {
resource = R.drawable.overlay_topo5_r;
resource = R.drawable.overlay_topo4_r;
}
else {
resource = R.drawable.overlay_topo5_l;
resource = R.drawable.overlay_topo4_l;
}
overlayCache[position] = getColouredDrawable(resource, OVERLAY_COLOR);
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.eisfeldj.augendiagnose.components;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -13,19 +14,19 @@
* Array adapter class to display an eye photo pair in a list.
*/
public class SelectTwoPicturesArrayAdapter extends ArrayAdapter<EyePhoto> {
protected final Context context;
protected final Activity activity;

protected EyePhoto[] eyePhotos;

public SelectTwoPicturesArrayAdapter(Context context, EyePhoto[] eyePhotos) {
super(context, R.layout.text_view_initializing, eyePhotos);
this.context = context;
public SelectTwoPicturesArrayAdapter(Activity activity, EyePhoto[] eyePhotos) {
super(activity, R.layout.text_view_initializing, eyePhotos);
this.activity = activity;
this.eyePhotos = eyePhotos;
}

public SelectTwoPicturesArrayAdapter(Context context) {
super(context, R.layout.adapter_list_pictures_for_name);
this.context = context;
this.activity = (Activity) context;
}

/**
Expand All @@ -34,9 +35,9 @@ public SelectTwoPicturesArrayAdapter(Context context) {
*/
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final EyeImageView eyeImageView = (EyeImageView) LayoutInflater.from(context).inflate(
final EyeImageView eyeImageView = (EyeImageView) LayoutInflater.from(activity).inflate(
R.layout.adapter_select_two_pictures, parent, false);
eyeImageView.setEyePhoto(eyePhotos[position], new Runnable() {
eyeImageView.setEyePhoto(activity, eyePhotos[position], new Runnable() {
@Override
public void run() {
TwoImageSelectionHandler.getInstance().highlightIfSelected(eyeImageView);
Expand Down

0 comments on commit 5ac9028

Please sign in to comment.