Skip to content

Commit

Permalink
Added Assisi Overlay
Browse files Browse the repository at this point in the history
Marked Circle button with image
  • Loading branch information
Joerg authored and Joerg committed Feb 22, 2014
1 parent 765a2ed commit f6c9528
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 22 deletions.
Binary file added Augendiagnose/res/drawable-hdpi/ic_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Augendiagnose/res/drawable-mdpi/ic_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Augendiagnose/res/drawable-xhdpi/ic_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Augendiagnose/res/drawable-xxhdpi/ic_circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Augendiagnose/res/drawable/circle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<bitmap
xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ic_circle"
android:gravity="center_vertical|center_horizontal"/>
18 changes: 16 additions & 2 deletions Augendiagnose/res/layout-land/activity_display_one_overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@
android:layout_height="0dp"
android:layout_weight="1"
android:checked="false"
android:gravity="center_vertical"
android:drawableLeft="@drawable/ic_circle"
android:paddingLeft="8dp"
android:onClick="onToggleOverlay0Clicked"
android:textOff="@string/toggle_overlay_circle"
android:textOn="@string/toggle_overlay_circle" />
android:textOff=""
android:textOn=""
android:textSize="0pt" />

<ToggleButton
android:id="@+id/toggleButtonOverlay1"
Expand Down Expand Up @@ -108,6 +112,16 @@
android:textOff="@string/toggle_overlay_4"
android:textOn="@string/toggle_overlay_4" />

<ToggleButton
android:id="@+id/toggleButtonOverlay5"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:checked="false"
android:onClick="onToggleOverlay5Clicked"
android:textOff="@string/toggle_overlay_5"
android:textOn="@string/toggle_overlay_5" />

<ToggleButton
android:id="@+id/toggleButtonLink"
android:layout_width="wrap_content"
Expand Down
16 changes: 14 additions & 2 deletions Augendiagnose/res/layout/activity_display_one_overlay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@
android:layout_height="match_parent"
android:layout_weight="1"
android:checked="false"
android:drawableBottom="@drawable/ic_circle"
android:textSize="0pt"
android:onClick="onToggleOverlay0Clicked"
android:textOff="@string/toggle_overlay_circle"
android:textOn="@string/toggle_overlay_circle" />
android:textOff=""
android:textOn="" />

<ToggleButton
android:id="@+id/toggleButtonOverlay1"
Expand Down Expand Up @@ -108,6 +110,16 @@
android:textOff="@string/toggle_overlay_4"
android:textOn="@string/toggle_overlay_4" />

<ToggleButton
android:id="@+id/toggleButtonOverlay5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:checked="false"
android:onClick="onToggleOverlay5Clicked"
android:textOff="@string/toggle_overlay_5"
android:textOn="@string/toggle_overlay_5" />

<ToggleButton
android:id="@+id/toggleButtonLink"
android:layout_width="0dp"
Expand Down
1 change: 1 addition & 0 deletions Augendiagnose/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<string name="toggle_overlay_2">IT 2</string>
<string name="toggle_overlay_3">IT 3</string>
<string name="toggle_overlay_4">IT 4</string>
<string name="toggle_overlay_5">IT 5</string>

<string name="content_description_right_eye">Rechtes Auge</string>
<string name="content_description_left_eye">Linkes Auge</string>
Expand Down
1 change: 1 addition & 0 deletions Augendiagnose/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<string name="toggle_overlay_2">IT 2</string>
<string name="toggle_overlay_3">IT 3</string>
<string name="toggle_overlay_4">IT 4</string>
<string name="toggle_overlay_5">IT 5</string>

<string name="content_description_right_eye">Right Eye</string>
<string name="content_description_left_eye">Left Eye</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ protected void onCreate(Bundle savedInstanceState) {
toggleOverlayButtons[2] = (ToggleButton) findViewById(R.id.toggleButtonOverlay2);
toggleOverlayButtons[3] = (ToggleButton) findViewById(R.id.toggleButtonOverlay3);
toggleOverlayButtons[4] = (ToggleButton) findViewById(R.id.toggleButtonOverlay4);
toggleOverlayButtons[5] = (ToggleButton) findViewById(R.id.toggleButtonOverlay5);

imageView.mLockButton = (ToggleButton) findViewById(R.id.toggleButtonLink);

Expand All @@ -72,6 +73,8 @@ protected void onCreate(Bundle savedInstanceState) {
toggleOverlayButtons[3].setVisibility(View.GONE);
toggleOverlayButtons[4].setEnabled(false);
toggleOverlayButtons[4].setVisibility(View.GONE);
toggleOverlayButtons[5].setEnabled(false);
toggleOverlayButtons[5].setVisibility(View.GONE);
}

// Initialize the listeners for the seekbars (brightness and contrast)
Expand Down Expand Up @@ -180,6 +183,15 @@ public void onToggleOverlay4Clicked(View view) {
onToggleOverlayClicked(view, 4);
}

/**
* onClick action for Button to toggle display of Overlay 5
*
* @param view
*/
public void onToggleOverlay5Clicked(View view) {
onToggleOverlayClicked(view, 5);
}

/**
* onClick action for Button to switch link between overlay and image
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import de.eisfeldj.augendiagnose.util.EyePhoto;
import de.eisfeldj.augendiagnose.util.EyePhoto.RightLeft;
import de.eisfeldj.augendiagnose.util.JpegMetadataUtil.Metadata;
import de.eisfeldj.augendiagnose.util.Logger;
import de.eisfeldj.augendiagnose.util.MediaStoreUtil;

/**
Expand All @@ -35,7 +34,7 @@
*
*/
public class OverlayPinchImageView extends PinchImageView {
public static final int OVERLAY_COUNT = 5;
public static final int OVERLAY_COUNT = 6;
private static final int OVERLAY_SIZE = 1024;
private static final int OVERLAY_COLOR = Color.RED;

Expand Down Expand Up @@ -83,14 +82,11 @@ public void setImage(String pathName) {
mHasCoordinates = false;
mPathName = pathName;
mBitmap = null;
final long time = System.currentTimeMillis();
Logger.log("Initiating thread " + time);

// Do image loading in separate thread
new Thread() {
@Override
public void run() {
Logger.log("Starting thread " + time);
mBitmap = mEyePhoto.getImageBitmap(maxBitmapSize);
mBitmapSmall = mEyePhoto.getImageBitmap(MediaStoreUtil.MINI_THUMB_SIZE);
final Metadata metadata = mEyePhoto.getImageMetadata();
Expand Down Expand Up @@ -326,6 +322,15 @@ private Drawable getOverlayDrawable(int position) {
}
overlayCache[position] = getColouredDrawable(resource, OVERLAY_COLOR);
break;
case 5:
if (mEyePhoto.getRightLeft().equals(RightLeft.RIGHT)) {
resource = R.drawable.overlay_topo5_r;
}
else {
resource = R.drawable.overlay_topo5_l;
}
overlayCache[position] = getColouredDrawable(resource, OVERLAY_COLOR);
break;
default:
if (mEyePhoto.getRightLeft().equals(RightLeft.RIGHT)) {
resource = R.drawable.overlay_circle_l;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public class EncryptionUtil {
private static MessageDigest messageDigest;
private static final String DUMMY_HASH = "dummy";
private static final int HASH_LENGTH = 8;
private static final String SPECIAL_KEY="Schnurpsi";

private static final String SPECIAL_KEY = "Schnurpsi";

static {
try {
Expand All @@ -31,46 +31,50 @@ public class EncryptionUtil {
cipherEncrypt.init(Cipher.ENCRYPT_MODE, symKey);

messageDigest = MessageDigest.getInstance("MD5");
} catch (Exception e) {
}
catch (Exception e) {
Log.e(Application.TAG, "Failed to initialize EncryptionUtil");
}
}

/**
* Utility method to test generation and validation of a user key
*
* @param name
*/
public static void test(String name) {
String key = createUserKey(name);
Logger.log("Key: " + key + ". Verified: " + validateUserKey(key));
Log.i(Application.TAG, "Key: " + key + ". Verified: " + validateUserKey(key));
}

/**
* Validate a user key
*
* @param key
* @return
*/
public static boolean validateUserKey(String key) {
if(key==null || key.length()==0) {
if (key == null || key.length() == 0) {
return false;
}
if(key.equals(SPECIAL_KEY)) {
if (key.equals(SPECIAL_KEY)) {
return true;
}

int index = key.lastIndexOf('-');
if(index>0) {
if (index > 0) {
String name = key.substring(0, index);
String hash = key.substring(index+1);
String hash = key.substring(index + 1);
return createCryptoHash(name).equals(hash);
}
else {
return false;
}
}

/**
* Generate a user key, which is a concatenation of user name and hash.
*
* @param input
* @return
*/
Expand All @@ -80,19 +84,22 @@ public static String createUserKey(String input) {

/**
* Create a cryptographic hash from a username
*
* @param input
* @return
*/
private static String createCryptoHash(String input) {
try {
return convertBase64(createHash(encrypt(input))).substring(0, HASH_LENGTH);
} catch (Exception e) {
}
catch (Exception e) {
return DUMMY_HASH;
}
}

/**
* Create a hash value from an input
*
* @param input
* @return
* @throws NoSuchAlgorithmException
Expand All @@ -103,6 +110,7 @@ private static byte[] createHash(byte[] input) throws NoSuchAlgorithmException {

/**
* Do base 64 encoding of a message
*
* @param bytes
* @return
*/
Expand All @@ -112,6 +120,7 @@ private static String convertBase64(byte[] bytes) {

/**
* Encrypt a String using DES
*
* @param input
* @return
* @throws BadPaddingException
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ else if (metadata instanceof TiffImageMetadata) {
List<TiffImageMetadata.Item> items = (List<TiffImageMetadata.Item>) tiffImageMetadata.getItems();

for (TiffImageMetadata.Item item : items) {
Logger.log(item.getTiffField().toString());
Log.i(Application.TAG, item.getTiffField().toString());
}

}
Expand All @@ -74,7 +74,7 @@ else if (metadata instanceof TiffImageMetadata) {
*/
public static void printAllXmpData(final File imageFile) throws ImageReadException, IOException, XMPException {
final String xmpString = Imaging.getXmpXml(imageFile);
Logger.log(new XmpHandler(xmpString).getXmpString());
Log.i(Application.TAG, new XmpHandler(xmpString).getXmpString());
}

/**
Expand Down

0 comments on commit f6c9528

Please sign in to comment.