diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..1158627
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+MemeProject
\ No newline at end of file
diff --git a/.idea/MemeProject.iml b/.idea/MemeProject.iml
new file mode 100644
index 0000000..82c0ec7
--- /dev/null
+++ b/.idea/MemeProject.iml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..9a8b7e5
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..b4e6f2a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..2c0769a
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..4426bac
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,638 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+ 1433797883204
+
+ 1433797883204
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.7
+
+
+
+
+
+
+
+
+
+
+
+ MemeProject
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.7
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MemeProject/.idea/compiler.xml b/MemeProject/.idea/compiler.xml
index 96cc43e..9a8b7e5 100644
--- a/MemeProject/.idea/compiler.xml
+++ b/MemeProject/.idea/compiler.xml
@@ -1,6 +1,7 @@
+
@@ -11,7 +12,6 @@
-
diff --git a/MemeProject/.idea/gradle.xml b/MemeProject/.idea/gradle.xml
index 3ec5955..1bbc21d 100644
--- a/MemeProject/.idea/gradle.xml
+++ b/MemeProject/.idea/gradle.xml
@@ -3,9 +3,8 @@
-
+
-
diff --git a/MemeProject/.idea/misc.xml b/MemeProject/.idea/misc.xml
index e930905..dae7a60 100644
--- a/MemeProject/.idea/misc.xml
+++ b/MemeProject/.idea/misc.xml
@@ -3,6 +3,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -13,10 +37,26 @@
-
+
+
+
+
+
+ 1.7
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MemeProject/.idea/runConfigurations.xml b/MemeProject/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/MemeProject/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MemeProject/.idea/scopes/scope_settings.xml b/MemeProject/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/MemeProject/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/MemeProject/MemeProject.iml b/MemeProject/MemeProject.iml
index 9a5441c..8014c22 100644
--- a/MemeProject/MemeProject.iml
+++ b/MemeProject/MemeProject.iml
@@ -8,7 +8,7 @@
-
+
diff --git a/MemeProject/app/app.iml b/MemeProject/app/app.iml
index f41a9f7..51ffbde 100644
--- a/MemeProject/app/app.iml
+++ b/MemeProject/app/app.iml
@@ -12,10 +12,12 @@
-
-
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
@@ -24,7 +26,7 @@
-
+
diff --git a/MemeProject/app/src/main/AndroidManifest.xml b/MemeProject/app/src/main/AndroidManifest.xml
index 1fe926e..6dc7913 100644
--- a/MemeProject/app/src/main/AndroidManifest.xml
+++ b/MemeProject/app/src/main/AndroidManifest.xml
@@ -1,7 +1,6 @@
+ package="madelyntav.c4q.nyc.memeproject">
@@ -14,8 +13,7 @@
+ android:screenOrientation="portrait">
@@ -25,8 +23,7 @@
+ android:screenOrientation="portrait">
diff --git a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ApplyFilters.java b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ApplyFilters.java
index 3e93a53..ee5dcd6 100644
--- a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ApplyFilters.java
+++ b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ApplyFilters.java
@@ -14,6 +14,7 @@
/**
* Created by c4q-ac35 on 6/4/15.
*/
+
public class ApplyFilters {
public static Bitmap engrave(Bitmap src) {
ConvolutionMatrix convMatrix = new ConvolutionMatrix(3);
@@ -36,10 +37,8 @@ public static Bitmap doInvert(Bitmap src) {
int width = src.getWidth();
// scan through every pixel
- for (int y = 0; y < height; y++)
- {
- for (int x = 0; x < width; x++)
- {
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
// get one pixel
pixelColor = src.getPixel(x, y);
// saving alpha channel
@@ -74,8 +73,8 @@ public static Bitmap doGreyscale(Bitmap src) {
int height = src.getHeight();
// scan through every single pixel
- for(int x = 0; x < width; ++x) {
- for(int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ for (int y = 0; y < height; ++y) {
// get one pixel color
pixel = src.getPixel(x, y);
// retrieve color of all channels
@@ -84,7 +83,7 @@ public static Bitmap doGreyscale(Bitmap src) {
G = Color.green(pixel);
B = Color.blue(pixel);
// take conversion up to one single value
- R = G = B = (int)(GS_RED * R + GS_GREEN * G + GS_BLUE * B);
+ R = G = B = (int) (GS_RED * R + GS_GREEN * G + GS_BLUE * B);
// set new pixel color to output bitmap
bmOut.setPixel(x, y, Color.argb(A, R, G, B));
}
@@ -104,8 +103,8 @@ public static Bitmap applyShadingFilter(Bitmap source, int shadingColor) {
int index = 0;
// iteration through pixels
- for(int y = 0; y < height; ++y) {
- for(int x = 0; x < width; ++x) {
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
// get current index in 2D-matrix
index = y * width + x;
// AND
@@ -132,10 +131,10 @@ public static Bitmap applyReflection(Bitmap originalImage) {
// create a Bitmap with the flip matrix applied to it.
// we only want the bottom half of the image
- Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height/2, width, height/2, matrix, false);
+ Bitmap reflectionImage = Bitmap.createBitmap(originalImage, 0, height / 2, width, height / 2, matrix, false);
// create a new bitmap with same width but taller to fit reflection
- Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height/2), Bitmap.Config.ARGB_8888);
+ Bitmap bitmapWithReflection = Bitmap.createBitmap(width, (height + height / 2), Bitmap.Config.ARGB_8888);
// create a new Canvas with the bitmap that's big enough for
// the image plus gap plus reflection
@@ -146,7 +145,7 @@ public static Bitmap applyReflection(Bitmap originalImage) {
Paint defaultPaint = new Paint();
canvas.drawRect(0, height, width, height + reflectionGap, defaultPaint);
// draw in the reflection
- canvas.drawBitmap(reflectionImage,0, height + reflectionGap, null);
+ canvas.drawBitmap(reflectionImage, 0, height + reflectionGap, null);
// create a shader that is a linear gradient that covers the reflection
Paint paint = new Paint();
diff --git a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ConvolutionMatrix.java b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ConvolutionMatrix.java
index 612d47b..cf23dab 100644
--- a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ConvolutionMatrix.java
+++ b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/ConvolutionMatrix.java
@@ -3,8 +3,7 @@
import android.graphics.Bitmap;
import android.graphics.Color;
-public class ConvolutionMatrix
-{
+public class ConvolutionMatrix {
public static final int SIZE = 3;
public double[][] Matrix;
@@ -24,8 +23,8 @@ public void setAll(double value) {
}
public void applyConfig(double[][] config) {
- for(int x = 0; x < SIZE; ++x) {
- for(int y = 0; y < SIZE; ++y) {
+ for (int x = 0; x < SIZE; ++x) {
+ for (int y = 0; y < SIZE; ++y) {
Matrix[x][y] = config[x][y];
}
}
@@ -40,52 +39,61 @@ public static Bitmap computeConvolution3x3(Bitmap src, ConvolutionMatrix matrix)
int sumR, sumG, sumB;
int[][] pixels = new int[SIZE][SIZE];
- for(int y = 0; y < height - 2; ++y) {
- for(int x = 0; x < width - 2; ++x) {
+ for (int y = 0; y < height - 2; ++y) {
+ for (int x = 0; x < width - 2; ++x) {
- // get pixel matrix
- for(int i = 0; i < SIZE; ++i) {
- for(int j = 0; j < SIZE; ++j) {
+ // Get pixel matrix
+ for (int i = 0; i < SIZE; ++i) {
+ for (int j = 0; j < SIZE; ++j) {
pixels[i][j] = src.getPixel(x + i, y + j);
}
}
- // get alpha of center pixel
+ // Get alpha of center pixel
A = Color.alpha(pixels[1][1]);
- // init color sum
+ // Init color sum
sumR = sumG = sumB = 0;
- // get sum of RGB on matrix
- for(int i = 0; i < SIZE; ++i) {
- for(int j = 0; j < SIZE; ++j) {
+ // Get sum of RGB on matrix
+ for (int i = 0; i < SIZE; ++i) {
+ for (int j = 0; j < SIZE; ++j) {
sumR += (Color.red(pixels[i][j]) * matrix.Matrix[i][j]);
sumG += (Color.green(pixels[i][j]) * matrix.Matrix[i][j]);
sumB += (Color.blue(pixels[i][j]) * matrix.Matrix[i][j]);
}
}
- // get final Red
- R = (int)(sumR / matrix.Factor + matrix.Offset);
- if(R < 0) { R = 0; }
- else if(R > 255) { R = 255; }
+ // Get final Red
+ R = (int) (sumR / matrix.Factor + matrix.Offset);
+ if (R < 0) {
+ R = 0;
+ } else if (R > 255) {
+ R = 255;
+ }
- // get final Green
- G = (int)(sumG / matrix.Factor + matrix.Offset);
- if(G < 0) { G = 0; }
- else if(G > 255) { G = 255; }
+ // Get final Green
+ G = (int) (sumG / matrix.Factor + matrix.Offset);
+ if (G < 0) {
+ G = 0;
+ } else if (G > 255) {
+ G = 255;
+ }
- // get final Blue
- B = (int)(sumB / matrix.Factor + matrix.Offset);
- if(B < 0) { B = 0; }
- else if(B > 255) { B = 255; }
+ // Get final Blue
+ B = (int) (sumB / matrix.Factor + matrix.Offset);
+ if (B < 0) {
+ B = 0;
+ } else if (B > 255) {
+ B = 255;
+ }
- // apply new pixel
+ // Apply new pixel
result.setPixel(x + 1, y + 1, Color.argb(A, R, G, B));
}
}
- // final image
+ // Final image
return result;
}
}
\ No newline at end of file
diff --git a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/CustomArrayAdapter.java b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/CustomArrayAdapter.java
index ea5d617..7448062 100644
--- a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/CustomArrayAdapter.java
+++ b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/CustomArrayAdapter.java
@@ -13,9 +13,10 @@
/**
* Created by kadeemmaragh on 6/4/15.
*/
+
public class CustomArrayAdapter extends ArrayAdapter {
- List memeNames= null;
+ List memeNames = null;
List memeImages = null;
private static LayoutInflater inflater = null;
@@ -32,13 +33,13 @@ public class CustomArrayAdapter extends ArrayAdapter {
@Override
public View getView(int position, View convertView,
ViewGroup parent) {
- if (convertView==null) {
- convertView=newView(parent);
+ if (convertView == null) {
+ convertView = newView(parent);
}
bindView(position, convertView);
- return(convertView);
+ return (convertView);
}
private View newView(ViewGroup parent) {
@@ -46,13 +47,12 @@ private View newView(ViewGroup parent) {
}
private void bindView(int position, View row) {
- TextView label=(TextView)row.findViewById(R.id.memeName);
+ TextView label = (TextView) row.findViewById(R.id.memeName);
label.setText(memeNames.get(position));
- ImageView icon=(ImageView)row.findViewById(R.id.memeImage);
+ ImageView icon = (ImageView) row.findViewById(R.id.memeImage);
icon.setImageResource(memeImages.get(position));
}
-
}
diff --git a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/EditPhoto.java b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/EditPhoto.java
index 5b6d269..c0cdc80 100644
--- a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/EditPhoto.java
+++ b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/EditPhoto.java
@@ -1,5 +1,8 @@
package madelyntav.c4q.nyc.memeproject;
+import android.app.AlertDialog;
+import android.app.Dialog;
+import android.content.DialogInterface;
import android.widget.Button;
import android.content.Context;
import android.app.Activity;
@@ -21,522 +24,598 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
+import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
+import android.widget.ToggleButton;
+import android.widget.ViewSwitcher;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
+public class EditPhoto extends Activity implements View.OnTouchListener, View.OnDragListener {
+
+ Bitmap b;
+ Bitmap bitmap;
+ private Button Vanilla;
+ private Button demotivational;
+ private ViewSwitcher switcher;
+ private EditText vanillaTitle, vanillaText, demoTitle, demoText;
+ private ImageView imageView, demoImage;
+ private String TAG = "GallerySaving";
+ RelativeLayout memeLayout;
+// LinearLayout linearLayout2;
+// LinearLayout linearLayout3;
+ Button ten;
+ Button fifteen;
+ Button twenty;
+ Button twentyfive;
+ Button black;
+ Button white;
+ Button red;
+ Button blue;
+ RelativeLayout root;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_edit_photo_2);
+
+ initializeViews();
+ setTypeAssets();
+ setOnTouchListeners();
+ initializeDragDropViews();
+
+ //-------------------------------TOGGLE MEME STYLE BUTTON-----------------------------//
+
+ // Toggle between vanilla and demotivational views
+ ToggleButton toggle = (ToggleButton) findViewById(R.id.btn_meme_type);
+ toggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+ if (isChecked) {
+ vanillaM(buttonView);
+ } else {
+ demotivate(buttonView);
+ }
+ }
+ });
- public class EditPhoto extends Activity implements View.OnTouchListener, View.OnDragListener {
-
-
- Bitmap b;
- Bitmap bitmap;
- private Button Vanilla;
- private Button demotivational;
- private EditText editText, editText2, demoTitle, demoText;
- private ImageView imageView, demoImage;
- private String TAG = "GallerySaving";
- RelativeLayout memeLayout;
- LinearLayout linearLayout2;
- LinearLayout linearLayout3;
- Button ten;
- Button fifteen;
- Button twenty;
- Button twentyfive;
- Button black;
- Button white;
- Button red;
- Button blue;
- RelativeLayout root;
-
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_edit_photo);
+ //----------------------------GET IMAGE FROM PREVIOUS INTENT--------------------------//
+ // Opens image in this activity
+ if (getIntent().hasExtra("byteArray")) {
+ b = BitmapFactory.decodeByteArray(getIntent().getByteArrayExtra("byteArray"), 0, getIntent().getByteArrayExtra("byteArray").length);
imageView = (ImageView) findViewById(R.id.mImageView);
- demoImage = (ImageView) findViewById(R.id.demotivationalImage);
-
- root = (RelativeLayout) findViewById(R.id.root);
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- ten = (Button) findViewById(R.id.ten);
- fifteen = (Button) findViewById(R.id.fifteen);
- twenty = (Button) findViewById(R.id.twenty);
- twentyfive = (Button) findViewById(R.id.twentyfive);
- black = (Button) findViewById(R.id.black);
- white = (Button) findViewById(R.id.white);
- red = (Button) findViewById(R.id.red);
- blue = (Button) findViewById(R.id.blue);
- Vanilla = (Button) findViewById(R.id.vanilla);
-
-
- editText = (EditText) findViewById(R.id.editText);
- editText2 = (EditText) findViewById(R.id.editText2);
- Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/impact.ttf");
-
- editText.setTypeface(custom_font);
- editText2.setTypeface(custom_font);
+ Vanilla = (Button) findViewById(R.id.vanilla);
+ vanillaTitle = (EditText) findViewById(R.id.vanillaTitle);
+ vanillaText = (EditText) findViewById(R.id.vanillaText);
+ demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
+ demoText = (EditText) findViewById(R.id.demotivationalText);
+ imageView.setImageBitmap(b);
+ demoImage.setImageBitmap(b);
+ } else {
- editText.setOnTouchListener(this);
- editText2.setOnTouchListener(this);
+ // Retrieve passed uri
+ Uri uri = getIntent().getExtras().getParcelable("image");
+ // Retrieve bitmap uri from intent
+ try {
+ bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ // Create bitmap for use within activity
+ try {
+ bitmap = Bitmap.createBitmap(MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ imageView.setImageBitmap(bitmap);
+ demoImage.setImageBitmap(bitmap);
+ }
- //Drag and drop layouts for drag and drop EditText feature
- LinearLayout textTop = (LinearLayout) findViewById(R.id.textTop);
- LinearLayout textMid = (LinearLayout) findViewById(R.id.textMid);
- LinearLayout textBot = (LinearLayout) findViewById(R.id.textBottom);
+ //-----------------------------SHARE BUTTON ONCLICKLISTENER---------------------------//
- textBot.setOnDragListener(this);
- textMid.setOnDragListener(this);
- textTop.setOnDragListener(this);
+ // Shares image via Email, Text, Bluetooth, etc...
+ Button share = (Button) findViewById(R.id.share);
+ share.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
imageView = (ImageView) findViewById(R.id.mImageView);
- demoImage = (ImageView) findViewById(R.id.demotivationalImage);
- memeLayout = (RelativeLayout) findViewById(R.id.meme);
-
-
- //----------------------------GET IMAGE FROM PREVIOUS INTENT--------------------------//
+ Vanilla = (Button) findViewById(R.id.vanilla);
+ vanillaTitle = (EditText) findViewById(R.id.vanillaTitle);
+ vanillaText = (EditText) findViewById(R.id.vanillaText);
+ vanillaTitle.setHint("");
+ vanillaText.setHint("");
- //opens pic in this activity
+ // Opens pic in this activity
if (getIntent().hasExtra("byteArray")) {
- b = BitmapFactory.decodeByteArray(getIntent().getByteArrayExtra("byteArray"), 0, getIntent().getByteArrayExtra("byteArray").length);
- imageView = (ImageView) findViewById(R.id.mImageView);
- Vanilla = (Button) findViewById(R.id.vanilla);
- editText = (EditText) findViewById(R.id.editText);
- editText2 = (EditText) findViewById(R.id.editText2);
- demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
- demoText = (EditText) findViewById(R.id.demotivationalText);
- imageView.setImageBitmap(b);
- demoImage.setImageBitmap(b);
-
- } else {
-
- //retrieve passed uri
- Uri uri = getIntent().getExtras().getParcelable("image");
- //retrieve bitmap uri from intent
- try {
- bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri);
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- //create bitmap for use within activity
- try {
- bitmap = Bitmap.createBitmap(MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri));
- } catch (IOException e) {
- e.printStackTrace();
- }
- imageView.setImageBitmap(bitmap);
- demoImage.setImageBitmap(bitmap);
+ Bundle extras = getIntent().getExtras();
+ byte[] byteArray = extras.getByteArray("byteArray");
+ Bitmap bm = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
+ imageView.setImageBitmap(bm);
}
- //-----------------------------SHARE BUTTON ONCLICKLISTENER---------------------------//
- // Shares image via Email, Text, Bluetooth, etc...
Button share = (Button) findViewById(R.id.share);
share.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
-
- imageView = (ImageView) findViewById(R.id.mImageView);
- Vanilla = (Button) findViewById(R.id.vanilla);
- editText = (EditText) findViewById(R.id.editText);
- editText2 = (EditText) findViewById(R.id.editText2);
- editText.setHint("");
- editText2.setHint("");
- //opens pic in this activity
- if (getIntent().hasExtra("byteArray")) {
- Bundle extras = getIntent().getExtras();
- byte[] byteArray = extras.getByteArray("byteArray");
- Bitmap bm = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
- imageView.setImageBitmap(bm);
- }
-
- Button share = (Button) findViewById(R.id.share);
- share.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String pathOfBmp = MediaStore.Images.Media.insertImage(getContentResolver(), b, "title", null);
- Uri bmpUri = Uri.parse(pathOfBmp);
- Intent attachIntent = new Intent(Intent.ACTION_SEND);
- attachIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
- attachIntent.setType("image/png");
- startActivity(attachIntent);
- }
- });
-
- b = getBitmapFromView(memeLayout);
-
String pathOfBmp = MediaStore.Images.Media.insertImage(getContentResolver(), b, "title", null);
Uri bmpUri = Uri.parse(pathOfBmp);
-
Intent attachIntent = new Intent(Intent.ACTION_SEND);
attachIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
attachIntent.setType("image/png");
startActivity(attachIntent);
}
});
- }
-
- //----------------------------VANILLA AND DEMOTIVATIONAL METHODS--------------------------//
-
- //Sets Vanilla meme editing view
- public void vanillaM(View v) {
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- editText = (EditText) findViewById(R.id.editText);
- editText2 = (EditText) findViewById(R.id.editText2);
- memeLayout = (RelativeLayout) findViewById(R.id.meme);
- demoImage = (ImageView) findViewById(R.id.demotivationalImage);
- demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
- demoText = (EditText) findViewById(R.id.demotivationalText);
- linearLayout2.setVisibility(View.VISIBLE);
- imageView.setVisibility(View.VISIBLE);
- editText.setVisibility(View.VISIBLE);
- editText2.setVisibility(View.VISIBLE);
- demoImage.setVisibility(View.INVISIBLE);
- demoTitle.setVisibility(View.INVISIBLE);
- demoText.setVisibility(View.INVISIBLE);
- }
-
- //Sets demotivational meme editing view
- public void demotivate(View v) {
-
- editText = (EditText) findViewById(R.id.editText);
- editText2 = (EditText) findViewById(R.id.editText2);
- memeLayout = (RelativeLayout) findViewById(R.id.meme);
- demoImage = (ImageView) findViewById(R.id.demotivationalImage);
- demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
- demoText = (EditText) findViewById(R.id.demotivationalText);
-
- memeLayout.setBackgroundColor(Color.BLACK);
- imageView.setVisibility(View.INVISIBLE);
- editText.setVisibility(View.INVISIBLE);
- editText2.setVisibility(View.INVISIBLE);
- demoImage.setVisibility(View.VISIBLE);
- demoTitle.setVisibility(View.VISIBLE);
- demoText.setVisibility(View.VISIBLE);
+ b = getBitmapFromView(memeLayout);
- }
-
- //-------------------------------IMAGE STORE AND SAVE METHODS-----------------------------//
-
- //onClick method for the save button. Calls other methods to create the save image function
- public void storeImage(View v) {
- editText.setHint("");
- editText2.setHint("");
- Bitmap image = getBitmapFromView(memeLayout);
- File pictureFile = createImageFile();
- addImageToFile(image, pictureFile);
-
- }
-
- /**
- * Create a File for saving an image
- * Handles file name, and where to store it
- */
- private File createImageFile() {
- String timeStamp = new SimpleDateFormat("MMddyyyy_HHmmss").format(new Date());
- String imageName = "MEME_" + timeStamp + ".jpg";
+ String pathOfBmp = MediaStore.Images.Media.insertImage(getContentResolver(), b, "title", null);
+ Uri bmpUri = Uri.parse(pathOfBmp);
- File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
- File imageFile = new File(path, imageName);
- Log.d("Path: ", path.getPath());
- return imageFile;
-
- }
-
- private void addImageToFile(Bitmap image, File file) {
- FileOutputStream fos = null;
- //Tries to add the bitmap image to the file
+ Intent attachIntent = new Intent(Intent.ACTION_SEND);
+ attachIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
+ attachIntent.setType("image/png");
+ startActivity(attachIntent);
+ }
+ });
+ }
+
+ //----------------------------VANILLA AND DEMOTIVATIONAL METHODS--------------------------//
+
+ // Sets Vanilla meme editing view
+ public void vanillaM(View v) {
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+ vanillaTitle = (EditText) findViewById(R.id.vanillaTitle);
+ vanillaText = (EditText) findViewById(R.id.vanillaText);
+ memeLayout = (RelativeLayout) findViewById(R.id.meme);
+ demoImage = (ImageView) findViewById(R.id.demotivationalImage);
+ demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
+ demoText = (EditText) findViewById(R.id.demotivationalText);
+
+// linearLayout2.setVisibility(View.VISIBLE);
+ imageView.setVisibility(View.VISIBLE);
+ vanillaTitle.setVisibility(View.VISIBLE);
+ vanillaText.setVisibility(View.VISIBLE);
+ demoImage.setVisibility(View.INVISIBLE);
+ demoTitle.setVisibility(View.INVISIBLE);
+ demoText.setVisibility(View.INVISIBLE);
+ }
+
+ // Sets demotivational meme editing view
+ public void demotivate(View v) {
+ vanillaTitle = (EditText) findViewById(R.id.vanillaTitle);
+ vanillaText = (EditText) findViewById(R.id.vanillaText);
+ memeLayout = (RelativeLayout) findViewById(R.id.meme);
+ demoImage = (ImageView) findViewById(R.id.demotivationalImage);
+ demoTitle = (EditText) findViewById(R.id.demotivationalTitle);
+ demoText = (EditText) findViewById(R.id.demotivationalText);
+
+ memeLayout.setBackgroundColor(Color.TRANSPARENT);
+ imageView.setVisibility(View.INVISIBLE);
+ vanillaTitle.setVisibility(View.INVISIBLE);
+ vanillaText.setVisibility(View.INVISIBLE);
+ demoImage.setVisibility(View.VISIBLE);
+ demoTitle.setVisibility(View.VISIBLE);
+ demoText.setVisibility(View.VISIBLE);
+ }
+
+ //-------------------------------IMAGE STORE AND SAVE METHODS-----------------------------//
+
+ // onClick method for the save button. Calls other methods to create the save image function
+ public void storeImage(View v) {
+ vanillaTitle.setHint("");
+ vanillaText.setHint("");
+ Bitmap image = getBitmapFromView(memeLayout);
+ File pictureFile = createImageFile();
+ addImageToFile(image, pictureFile);
+ }
+
+ // Creates a File for saving an image. Handles file name and save destination
+ private File createImageFile() {
+ String timeStamp = new SimpleDateFormat("MMddyyyy_HHmmss").format(new Date());
+ String imageName = "MEME_" + timeStamp + ".jpg";
+
+ File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
+ File imageFile = new File(path, imageName);
+ Log.d("Path: ", path.getPath());
+ return imageFile;
+
+ }
+
+ private void addImageToFile(Bitmap image, File file) {
+ FileOutputStream fos = null;
+ //Tries to add the bitmap image to the file
+ try {
+ fos = new FileOutputStream(file);
+ image.compress(Bitmap.CompressFormat.PNG, 90, fos);
+
+ Toast.makeText(this, "Saved image to camera pictures", Toast.LENGTH_SHORT).show();
+
+ } catch (Exception e) {
+ Log.d(TAG, "trying to compress image did not work" + e.getMessage());
+ } finally {
try {
- fos = new FileOutputStream(file);
- image.compress(Bitmap.CompressFormat.PNG, 90, fos);
-
- Toast.makeText(this, "Saved image to camera pictures", Toast.LENGTH_SHORT).show();
-
- } catch (Exception e) {
- Log.d(TAG, "trying to compress image did not work" + e.getMessage());
- } finally {
- try {
- if (fos != null) {
- fos.close(); //Closes the fileoutput stream
- //Scans the image file that was just created so user can immediately see it in Pictures
- try {
- Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
- Uri uri = Uri.fromFile(file);
- mediaScanIntent.setData(uri);
- sendBroadcast(mediaScanIntent);
- } catch (Exception e) {
- Log.d("scanIntent", "Failed: ");
- }
+ if (fos != null) {
+ fos.close(); //Closes the fileoutput stream
+ //Scans the image file that was just created so user can immediately see it in Pictures
+ try {
+ Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
+ Uri uri = Uri.fromFile(file);
+ mediaScanIntent.setData(uri);
+ sendBroadcast(mediaScanIntent);
+ } catch (Exception e) {
+ Log.d("scanIntent", "Failed: ");
}
- } catch (IOException e) {
- Log.d(TAG, "fos did not close " + e.getMessage());
}
- }
-
- }
-
- //------------------------------CREATE BITMAP FROM VIEW METHOD----------------------------//
-
- //Takes the current view and creates a bitmap representing that view.
- public Bitmap getBitmapFromView(View view) {
- Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(returnedBitmap);
-
- Drawable bgDrawable = view.getBackground();
- if (bgDrawable != null)
- bgDrawable.draw(canvas);
- else
- canvas.drawColor(Color.WHITE);
- view.draw(canvas);
- return returnedBitmap;
- }
-
-
- //---------------------------------DRAGGING EDITTEXT METHODS------------------------------//
-
- // onTouch and onDrag work together to allow for views to be moved around within the layout
- //to children of that layout
- public boolean onTouch(View v, MotionEvent e) {
- if (e.getAction() == MotionEvent.ACTION_DOWN) {//Action_Down means a pressed gesture had started, view has been set in motion
- View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v);//Creates an image that the system displays during the drag and drop operation.
- v.startDrag(null, shadowBuilder, v, 0);
- v.isInEditMode();
- v.setVisibility(View.INVISIBLE);
- return true;
- } else {
- return false;
+ } catch (IOException e) {
+ Log.d(TAG, "fos did not close " + e.getMessage());
}
}
-
-
- public boolean onDrag(View v, DragEvent e) {
- if (e.getAction() == DragEvent.ACTION_DROP) {//if the shadow has been released within the view
- View view = (View) e.getLocalState();
- ViewGroup from = (ViewGroup) view.getParent();
-
- LinearLayout to = (LinearLayout) v;
-
- if((to.getResources().getInteger(Integer.valueOf(R.id.editText)) == (from.getResources().getInteger(Integer.valueOf(R.id.editText2))))) {
-
-
-
- }
- from.removeView(view);
- to.addView(view);
- view.setVisibility(View.VISIBLE);
-
-
- view.requestFocus();
- InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
-
-
- }
+ }
+
+ //------------------------------CREATE BITMAP FROM VIEW METHOD----------------------------//
+ //-----------Takes the current view and creates a bitmap representing that view-----------//
+
+ public Bitmap getBitmapFromView(View view) {
+ Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(returnedBitmap);
+
+ Drawable bgDrawable = view.getBackground();
+ if (bgDrawable != null)
+ bgDrawable.draw(canvas);
+ else
+ canvas.drawColor(Color.WHITE);
+ view.draw(canvas);
+ return returnedBitmap;
+ }
+
+ //---------------------------------DRAGGING EDITTEXT METHODS------------------------------//
+ // onTouch and onDrag work together to allow for views to be moved around within the layout
+ // to children of that layout
+
+ public boolean onTouch(View v, MotionEvent e) {
+ if (e.getAction() == MotionEvent.ACTION_DOWN) { // Action_Down means a pressed gesture had started, view has been set in motion
+ View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(v); // Creates an image that the system displays during the drag and drop operation.
+ v.startDrag(null, shadowBuilder, v, 0);
+ v.isInEditMode();
+ v.setVisibility(View.INVISIBLE);
return true;
+ } else {
+ return false;
}
+ }
+ public boolean onDrag(View v, DragEvent e) {
+ if (e.getAction() == DragEvent.ACTION_DROP) { // If the shadow has been released within the view
+ View view = (View) e.getLocalState();
+ ViewGroup from = (ViewGroup) view.getParent();
- //----------------------------VANILLA EDITTEXT FONT SIZE METHODS--------------------------//
+ LinearLayout to = (LinearLayout) v;
+ if ((to.getResources().getInteger(Integer.valueOf(R.id.vanillaTitle)) == (from.getResources().getInteger(Integer.valueOf(R.id.vanillaText))))) {
- // Sets Vanilla font size to 10sp
- public void setTen(View v) {
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
-
- linearLayout2.setVisibility(View.GONE);
- linearLayout3.setVisibility(View.VISIBLE);
- editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
- editText2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
- }
-
- // Sets Vanilla font size to 15sp
- public void setFifteen(View v) {
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout2.setVisibility(View.GONE);
- linearLayout3.setVisibility(View.VISIBLE);
- editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
- editText2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
- }
- // Sets Vanilla font size to 20sp
- public void setTwenty(View v) {
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout2.setVisibility(View.GONE);
- linearLayout3.setVisibility(View.VISIBLE);
- editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
- editText2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
- }
-
- // Sets Vanilla font size to 25sp
- public void setTwentyfive(View v) {
- linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout2.setVisibility(View.GONE);
- linearLayout3.setVisibility(View.VISIBLE);
- editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 25);
- editText2.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 25);
- }
-
- //---------------------------VANILLA EDITTEXT FONT COLOR METHODS--------------------------//
-
- // Sets Vanilla font to black
- public void setBlack(View v) {
-
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout3.setVisibility(View.GONE);
- editText.setVisibility(View.VISIBLE);
- editText2.setVisibility(View.VISIBLE);
- }
-
- // Sets Vanilla font to white
- public void setWhite(View v) {
+ }
+ from.removeView(view);
+ to.addView(view);
+ view.setVisibility(View.VISIBLE);
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout3.setVisibility(View.GONE);
- editText.setVisibility(View.VISIBLE);
- editText2.setVisibility(View.VISIBLE);
- editText.setTextColor(Color.WHITE);
- editText2.setTextColor(Color.WHITE);
- }
- // Sets Vanilla font to red
- public void setRed(View v) {
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout3.setVisibility(View.GONE);
- editText.setVisibility(View.VISIBLE);
- editText2.setVisibility(View.VISIBLE);
- editText.setTextColor(Color.RED);
- editText2.setTextColor(Color.RED);
- }
+ view.requestFocus();
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
- // Sets Vanilla font to blue
- public void setBlue(View v) {
- linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
- linearLayout3.setVisibility(View.GONE);
- editText.setVisibility(View.VISIBLE);
- editText2.setVisibility(View.VISIBLE);
- editText.setTextColor(Color.BLUE);
- editText2.setTextColor(Color.BLUE);
}
-
-
- //----------------------------------IMAGE EFFECTS METHODS---------------------------------//
-
- // Applies engrave effect to image
- public void engravedImage(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap engraved = ApplyFilters.engrave(b);
- imageView.setImageBitmap(engraved);
- demoImage.setImageBitmap(engraved);
- } else {
- Bitmap engraved = ApplyFilters.engrave(bitmap);
- imageView.setImageBitmap(engraved);
- demoImage.setImageBitmap(engraved);
- }
- Toast.makeText(this, "Engraved!", Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+
+ //----------------------------VANILLA EDITTEXT FONT SIZE METHODS--------------------------//
+ //---------------These methods modify the font size of the Vanilla EditTexts--------------//
+
+ public void setTen(View v) {
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+//
+// linearLayout2.setVisibility(View.GONE);
+// linearLayout3.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
+ vanillaText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
+ }
+
+ public void setFifteen(View v) {
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout2.setVisibility(View.GONE);
+// linearLayout3.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
+ vanillaText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
+ }
+
+ public void setTwenty(View v) {
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout2.setVisibility(View.GONE);
+// linearLayout3.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
+ vanillaText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
+ }
+
+ public void setTwentyfive(View v) {
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout2.setVisibility(View.GONE);
+// linearLayout3.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 25);
+ vanillaText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 25);
+ }
+
+ //---------------------------VANILLA EDITTEXT FONT COLOR METHODS--------------------------//
+ //-----------------These methods modify the color of the Vanilla EditTexts----------------//
+
+ public void setBlack(View v) {
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout3.setVisibility(View.GONE);
+ vanillaTitle.setVisibility(View.VISIBLE);
+ vanillaText.setVisibility(View.VISIBLE);
+ }
+
+ public void setWhite(View v) {
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout3.setVisibility(View.GONE);
+ vanillaTitle.setVisibility(View.VISIBLE);
+ vanillaText.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextColor(Color.WHITE);
+ vanillaText.setTextColor(Color.WHITE);
+ }
+
+ public void setRed(View v) {
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout3.setVisibility(View.GONE);
+ vanillaTitle.setVisibility(View.VISIBLE);
+ vanillaText.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextColor(Color.RED);
+ vanillaText.setTextColor(Color.RED);
+ }
+
+ public void setBlue(View v) {
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+// linearLayout3.setVisibility(View.GONE);
+ vanillaTitle.setVisibility(View.VISIBLE);
+ vanillaText.setVisibility(View.VISIBLE);
+ vanillaTitle.setTextColor(Color.BLUE);
+ vanillaText.setTextColor(Color.BLUE);
+ }
+
+ //----------------------------------IMAGE EFFECTS METHODS---------------------------------//
+ //---------------These methods apply various colors and effects to an image---------------//
+
+ public void engravedImage(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap engraved = ApplyFilters.engrave(b);
+ imageView.setImageBitmap(engraved);
+ demoImage.setImageBitmap(engraved);
+ } else {
+ Bitmap engraved = ApplyFilters.engrave(bitmap);
+ imageView.setImageBitmap(engraved);
+ demoImage.setImageBitmap(engraved);
}
-
- // Applies inverted colors effect to image
- public void invertColors(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap inverted = ApplyFilters.doInvert(b);
- imageView.setImageBitmap(inverted);
- demoImage.setImageBitmap(inverted);
- } else {
- Bitmap inverted = ApplyFilters.doInvert(bitmap);
- imageView.setImageBitmap(inverted);
- demoImage.setImageBitmap(inverted);
- }
- Toast.makeText(this,"Inverted!",Toast.LENGTH_SHORT).show();
-
+ Toast.makeText(this, "Engraved!", Toast.LENGTH_SHORT).show();
+ }
+
+ public void invertColors(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap inverted = ApplyFilters.doInvert(b);
+ imageView.setImageBitmap(inverted);
+ demoImage.setImageBitmap(inverted);
+ } else {
+ Bitmap inverted = ApplyFilters.doInvert(bitmap);
+ imageView.setImageBitmap(inverted);
+ demoImage.setImageBitmap(inverted);
}
-
- // Applies greyscale effect to image
- public void greyscaleImage(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap greyscaled = ApplyFilters.doGreyscale(b);
- imageView.setImageBitmap(greyscaled);
- demoImage.setImageBitmap(greyscaled);
- } else {
- Bitmap greyscaled = ApplyFilters.doGreyscale(bitmap);
- imageView.setImageBitmap(greyscaled);
- demoImage.setImageBitmap(greyscaled);
- }
- Toast.makeText(this,"Old School Flow!",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, "Inverted!", Toast.LENGTH_SHORT).show();
+
+ }
+
+ public void greyscaleImage(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap greyscaled = ApplyFilters.doGreyscale(b);
+ imageView.setImageBitmap(greyscaled);
+ demoImage.setImageBitmap(greyscaled);
+ } else {
+ Bitmap greyscaled = ApplyFilters.doGreyscale(bitmap);
+ imageView.setImageBitmap(greyscaled);
+ demoImage.setImageBitmap(greyscaled);
}
-
- // Applies blue shading effect to image
- public void shadingFilterBlue(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap blueShade = ApplyFilters.applyShadingFilter(b, Color.BLUE);
- imageView.setImageBitmap(blueShade);
- demoImage.setImageBitmap(blueShade);
- } else {
- Bitmap blueShade = ApplyFilters.applyShadingFilter(bitmap, Color.BLUE);
- imageView.setImageBitmap(blueShade);
- demoImage.setImageBitmap(blueShade);
- }
- Toast.makeText(this,"BLUE!",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, "Old School Flow!", Toast.LENGTH_SHORT).show();
+ }
+
+ public void shadingFilterBlue(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap blueShade = ApplyFilters.applyShadingFilter(b, Color.BLUE);
+ imageView.setImageBitmap(blueShade);
+ demoImage.setImageBitmap(blueShade);
+ } else {
+ Bitmap blueShade = ApplyFilters.applyShadingFilter(bitmap, Color.BLUE);
+ imageView.setImageBitmap(blueShade);
+ demoImage.setImageBitmap(blueShade);
}
-
- // Applies red shading effect to image
- public void shadingFilterRed(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap redShade = ApplyFilters.applyShadingFilter(b, Color.RED);
- imageView.setImageBitmap(redShade);
- demoImage.setImageBitmap(redShade);
- } else {
- Bitmap redShade = ApplyFilters.applyShadingFilter(bitmap, Color.RED);
- imageView.setImageBitmap(redShade);
- demoImage.setImageBitmap(redShade);
- }
- Toast.makeText(this,"RED!",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, "BLUE!", Toast.LENGTH_SHORT).show();
+ }
+
+ public void shadingFilterRed(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap redShade = ApplyFilters.applyShadingFilter(b, Color.RED);
+ imageView.setImageBitmap(redShade);
+ demoImage.setImageBitmap(redShade);
+ } else {
+ Bitmap redShade = ApplyFilters.applyShadingFilter(bitmap, Color.RED);
+ imageView.setImageBitmap(redShade);
+ demoImage.setImageBitmap(redShade);
}
-
- // Applies green shading effect to image
- public void shadingFilterGreen(View view) {
-
- if (getIntent().hasExtra("byteArray")) {
- Bitmap greenShade = ApplyFilters.applyShadingFilter(b, Color.GREEN);
- imageView.setImageBitmap(greenShade);
- demoImage.setImageBitmap(greenShade);
- } else {
- Bitmap greenShade = ApplyFilters.applyShadingFilter(bitmap, Color.GREEN);
- imageView.setImageBitmap(greenShade);
- demoImage.setImageBitmap(greenShade);
- }
- Toast.makeText(this,"GREEN FACES ONLY!!",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, "RED!", Toast.LENGTH_SHORT).show();
+ }
+
+ public void shadingFilterGreen(View view) {
+
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap greenShade = ApplyFilters.applyShadingFilter(b, Color.GREEN);
+ imageView.setImageBitmap(greenShade);
+ demoImage.setImageBitmap(greenShade);
+ } else {
+ Bitmap greenShade = ApplyFilters.applyShadingFilter(bitmap, Color.GREEN);
+ imageView.setImageBitmap(greenShade);
+ demoImage.setImageBitmap(greenShade);
}
-
- // Applies reflection effect to image
- public void reflectionEffect(View view) {
- if (getIntent().hasExtra("byteArray")) {
- Bitmap reflected = ApplyFilters.applyReflection(b);
- imageView.setImageBitmap(reflected);
- demoImage.setImageBitmap(reflected);
- } else {
- Bitmap reflected = ApplyFilters.applyReflection(bitmap);
- imageView.setImageBitmap(reflected);
- demoImage.setImageBitmap(reflected);
- }
- Toast.makeText(this,"Reflected!",Toast.LENGTH_SHORT).show();
+ Toast.makeText(this, "GREEN FACES ONLY!!", Toast.LENGTH_SHORT).show();
+ }
+
+ public void reflectionEffect(View view) {
+ if (getIntent().hasExtra("byteArray")) {
+ Bitmap reflected = ApplyFilters.applyReflection(b);
+ imageView.setImageBitmap(reflected);
+ demoImage.setImageBitmap(reflected);
+ } else {
+ Bitmap reflected = ApplyFilters.applyReflection(bitmap);
+ imageView.setImageBitmap(reflected);
+ demoImage.setImageBitmap(reflected);
}
- }
\ No newline at end of file
+ Toast.makeText(this, "Reflected!", Toast.LENGTH_SHORT).show();
+ }
+
+ //--------------------------------------REFACTORING---------------------------------------//
+ //-------------------------------Cleaning up onCreate method------------------------------//
+
+ private void initializeViews() {
+ imageView = (ImageView) findViewById(R.id.mImageView);
+ demoImage = (ImageView) findViewById(R.id.demotivationalImage);
+
+ root = (RelativeLayout) findViewById(R.id.root);
+// linearLayout2 = (LinearLayout) findViewById(R.id.linearLayout2);
+// linearLayout3 = (LinearLayout) findViewById(R.id.linearLayout3);
+ ten = (Button) findViewById(R.id.ten);
+ fifteen = (Button) findViewById(R.id.fifteen);
+ twenty = (Button) findViewById(R.id.twenty);
+ twentyfive = (Button) findViewById(R.id.twentyfive);
+ black = (Button) findViewById(R.id.black);
+ white = (Button) findViewById(R.id.white);
+ red = (Button) findViewById(R.id.red);
+ blue = (Button) findViewById(R.id.blue);
+ Vanilla = (Button) findViewById(R.id.vanilla);
+
+ vanillaTitle = (EditText) findViewById(R.id.vanillaTitle);
+ vanillaText = (EditText) findViewById(R.id.vanillaText);
+ }
+
+ private void setTypeAssets() {
+ Typeface custom_font = Typeface.createFromAsset(getAssets(), "fonts/impact.ttf");
+ vanillaTitle.setTypeface(custom_font);
+ vanillaText.setTypeface(custom_font);
+ }
+
+ private void setOnTouchListeners() {
+ vanillaTitle.setOnTouchListener(this);
+ vanillaText.setOnTouchListener(this);
+ }
+
+ private void initializeDragDropViews() {
+ //Drag and drop layouts for drag and drop EditText feature
+ LinearLayout textTop = (LinearLayout) findViewById(R.id.textTop);
+ LinearLayout textMid = (LinearLayout) findViewById(R.id.textMid);
+ LinearLayout textBot = (LinearLayout) findViewById(R.id.textBottom);
+
+ // FIXME: This throws a Null Pointer Exception -- consolidate the above views.
+ textBot.setOnDragListener(this);
+ textMid.setOnDragListener(this);
+ textTop.setOnDragListener(this);
+
+ imageView = (ImageView) findViewById(R.id.mImageView);
+ demoImage = (ImageView) findViewById(R.id.demotivationalImage);
+ memeLayout = (RelativeLayout) findViewById(R.id.meme);
+ }
+
+ //--------------------------------------DIALOG BOXES--------------------------------------//
+ //------Helps reduce on-screen clutter, makes certain features more easily accessible-----//
+
+ public Dialog editTextColor(final View v) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.choose_color)
+ .setItems(R.array.colors_array, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int selection) {
+ // Call text color setting methods based on value of selection
+
+ if (selection == 0) {
+ setWhite(v);
+ } else if (selection == 1) {
+ setBlack(v);
+ } else if (selection == 2) {
+ setRed(v);
+ } else if (selection == 3) {
+ setBlue(v);
+ }
+ }
+ });
+ return builder.create();
+ }
+
+ public Dialog editTextSize(final View v) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.choose_size)
+ .setItems(R.array.size_array, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int selection) {
+ // Call text size setting methods based on value of selection
+
+ if (selection == 0) {
+ setTen(v);
+ } else if (selection == 1) {
+ setFifteen(v);
+ } else if (selection == 2) {
+ setTwenty(v);
+ } else if (selection == 3) {
+ setTwentyfive(v);
+ }
+ }
+ });
+ return builder.create();
+ }
+
+ public Dialog editEffect(final View v) {
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.choose_effect)
+ .setItems(R.array.effect_array, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int selection) {
+ // Call effect setting methods based on value of selection
+
+ if (selection == 0) {
+ engravedImage(v);
+ } else if (selection == 1) {
+ invertColors(v);
+ } else if (selection == 2) {
+ greyscaleImage(v);
+ } else if (selection == 3) {
+ reflectionEffect(v);
+ } else if (selection == 4) {
+ shadingFilterRed(v);
+ } else if (selection == 5) {
+ shadingFilterGreen(v);
+ } else {
+ shadingFilterBlue(v);
+ }
+ }
+ });
+ return builder.create();
+ }
+}
\ No newline at end of file
diff --git a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/MainActivity.java b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/MainActivity.java
index 6aa7d96..5184458 100644
--- a/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/MainActivity.java
+++ b/MemeProject/app/src/main/java/madelyntav/c4q/nyc/memeproject/MainActivity.java
@@ -13,12 +13,12 @@
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;
+
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-
public class MainActivity extends ActionBarActivity {
private ImageView mImageView;
static final int REQUEST_IMAGE_CAPTURE = 1;
@@ -50,7 +50,6 @@ public void usePic(View v) {
startActivityForResult(choosePictureIntent, 0);
}
-
public void takePic(View v) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
@@ -58,10 +57,9 @@ public void takePic(View v) {
}
}
-
- @Override // saves pic and sends it to editPhoto activity
+ @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-
+ // Saves image and sends it to editPhoto activity
Intent intent = new Intent(MainActivity.this, EditPhoto.class);
if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
@@ -72,30 +70,27 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
intent.putExtra("byteArray", bs.toByteArray());
startActivity(intent);
-
} else if (requestCode == EXTERNAL_CONTENT_URI && resultCode == RESULT_OK) {
- //Image selected message
+ // Image selected message
Toast.makeText(this, "Image Selected!", Toast.LENGTH_SHORT).show();
- // get Uri from selected image
+ // get Uri from selected image
Uri targetUri = data.getData();
Bitmap bitmap = null;
ContentResolver cr = getContentResolver();
ByteArrayOutputStream bs = new ByteArrayOutputStream();
- //turn selected image into a Bitmap image
+ // Turn selected image into a Bitmap image
try {
bitmap = MediaStore.Images.Media.getBitmap(cr, targetUri);
} catch (IOException e) {
e.printStackTrace();
}
- //pass image to intent
+ // Pass image to intent
intent.putExtra("image", targetUri);
mImageView.setImageBitmap(bitmap);
startActivity(intent);
-
}
}
-
}
\ No newline at end of file
diff --git a/MemeProject/app/src/main/res/layout/activity_edit_photo.xml b/MemeProject/app/src/main/res/layout/activity_edit_photo.xml
index 845204d..359ad36 100644
--- a/MemeProject/app/src/main/res/layout/activity_edit_photo.xml
+++ b/MemeProject/app/src/main/res/layout/activity_edit_photo.xml
@@ -1,85 +1,84 @@
+ tools:context="madelyntav.c4q.nyc.memeproject.EditPhoto">
-
+ android:orientation="vertical">
-
+ android:layout_alignParentTop="true"
+ android:layout_centerHorizontal="true"
+ android:orientation="horizontal">
-
+
-
+
-
+
-
+ android:layout_centerHorizontal="true"
+ android:orientation="horizontal">
-
+
+
+
-
+
-
+
@@ -90,285 +89,300 @@
+ android:text="Chose text size:" />
+
+ android:text="10"
+ android:textSize="10dp" />
+
+ android:text="15"
+ android:textSize="15dp" />
+
+ android:text="20"
+ android:textSize="20dp" />
+
+ android:text="25"
+ android:textSize="25dp" />
+ android:layout_weight="1"
+ android:text="Chose text color:" />
+
+ android:text="black"
+ android:textSize="10dp" />
+
+ android:textSize="10dp" />
+
+ android:text="red"
+ android:textColor="#FF0000" />
+
+ android:text="blue"
+ android:textColor="#0000FF" />
+
+
+
+ android:id="@+id/effectButtons"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="5dp"
+ android:orientation="vertical">
-
-
-
-
-
-
-
-
-
+ android:onClick="engravedImage"
+ android:src="@drawable/engraved" />
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
- android:singleLine="false" />
-
+
+
+ android:orientation="vertical"
+ android:textAlignment="center">
-
+ android:textColor="#ffffff"
+ android:textSize="30sp"
+ android:textStyle="bold"
+ android:visibility="invisible" />
+
-
+
-
+
diff --git a/MemeProject/app/src/main/res/layout/activity_edit_photo_2.xml b/MemeProject/app/src/main/res/layout/activity_edit_photo_2.xml
new file mode 100644
index 0000000..4439b60
--- /dev/null
+++ b/MemeProject/app/src/main/res/layout/activity_edit_photo_2.xml
@@ -0,0 +1,173 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MemeProject/app/src/main/res/values/arrays.xml b/MemeProject/app/src/main/res/values/arrays.xml
new file mode 100644
index 0000000..f9f4eb0
--- /dev/null
+++ b/MemeProject/app/src/main/res/values/arrays.xml
@@ -0,0 +1,31 @@
+
+
+
+ - White
+ - Black
+ - Red
+ - Blue
+
+
+
+ - X-Small
+ - Small
+ - Medium
+ - Large
+
+
+
+ - Engrave
+ - Invert
+ - Grayscale
+ - Reflect
+ - Red Filter
+ - Green Filter
+ - Blue Filter
+
+
+
+ - temp
+
+
+
\ No newline at end of file
diff --git a/MemeProject/app/src/main/res/values/strings.xml b/MemeProject/app/src/main/res/values/strings.xml
index ba335ed..6c71743 100644
--- a/MemeProject/app/src/main/res/values/strings.xml
+++ b/MemeProject/app/src/main/res/values/strings.xml
@@ -2,8 +2,11 @@
MemeProject
MainActivity
- Hello world!
Settings
EditMeme
EditPhoto
+ Choose a color:
+ Choose a size:
+ Choose an effect:
+ Choose a template:
diff --git a/MemeProject/app/src/main/res/values/styles.xml b/MemeProject/app/src/main/res/values/styles.xml
index 766ab99..68f9820 100644
--- a/MemeProject/app/src/main/res/values/styles.xml
+++ b/MemeProject/app/src/main/res/values/styles.xml
@@ -5,4 +5,14 @@
+
+
+
+
diff --git a/README.md b/README.md
index a21b306..9c8facd 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,14 @@
+Hello! This project is incomplete as of submission (Fri, 06/12) as I was out of town. Included is progress I made earlier in the week (Mon/Tues). I am still rewriting the code to fit with the XML, so beware! This app does not currently launch (I left myself a note indicating where/why). I will continue to work on this over the weekend.
+
+**Quick write-up:**
+* Refactored code - moved view initialization, setting of listeners to their own methods in order to clean-up onCreate().
+* Removed some extraneous/redundant comments
+* Started to rewrite layout XML for EditPhoto.java -- main objective of my fork. This app is robust feature-wise, but UI is cluttered and not the most straightforward in terms of usability. Still need to fill in drawables, etc.
+* Added dialog boxes in order to remove clutter from editor view and make editing options more immediately accessible.
+* As we were instructed not to rewrite a lot of the code, I suggested that the team look into ViewFlipper to manage vanilla/demotivation meme views. I think this would help their code in terms of removing all the visibility settings they have to make programatically.
+
+----------------------------------------------------------------------------
+
Include your team name, how many hours you believe each of you worked on this over the course of the week, who was responsible for what features, and general project navigation.
#Team Name: Maddy and the Cool Cats