diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/ChooseMemeStyle.java b/app/src/main/java/meme5/c4q/nyc/meme_project/ChooseMemeStyle.java
index e89f9ae..6d53df9 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/ChooseMemeStyle.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/ChooseMemeStyle.java
@@ -8,28 +8,16 @@
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
import android.view.View;
-import android.widget.Button;
import android.widget.ImageView;
-import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
-import android.widget.Toast;
-
-import java.util.Random;
-
+//user chooses either demotivational meme style or vanilla meme style
public class ChooseMemeStyle extends Activity {
-
public static final String TAG = "MEME_ACTIVITY";
- protected RadioGroup styleGroup;
- protected RadioButton styleButton;
- protected Button nextButton;
protected boolean vanilla;
- protected Random slideShow;
ImageView img, thumbnail;
AnimationDrawable frameAnimation;
String imgFilePath;
@@ -40,6 +28,17 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_choose_meme_style);
+ getMeme();
+
+ applyCustomFont();
+
+ RadioGroup group = (RadioGroup) findViewById(R.id.styleGroup);
+ group.setOnCheckedChangeListener(radioGroupChangeListener);
+ group.check(R.id.chooseDemotivational);
+
+ }
+
+ public void getMeme() {
Bundle bundle = getIntent().getExtras();
if(bundle.getString("imgFilePath") != null)
{
@@ -48,7 +47,9 @@ protected void onCreate(Bundle savedInstanceState) {
thumbnail = (ImageView) findViewById(R.id.thumbnail);
Bitmap bmp2 = BitmapFactory.decodeFile(imgFilePath);
thumbnail.setImageBitmap(bmp2);
+ }
+ public void applyCustomFont(){
//apply fonts -
//TODO: need to find a way to add this font globally through style!
TextView step1 = (TextView) findViewById(R.id.step1);
@@ -65,64 +66,59 @@ protected void onCreate(Bundle savedInstanceState) {
title.setTypeface(tf);
vanillaRadio.setTypeface(tf);
demotivationalRadio.setTypeface(tf);
+ }
- RadioGroup group = (RadioGroup) findViewById(R.id.styleGroup);
- group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
- Log.d(TAG, "onCheckedChanged()");
- // Is the button now checked?
+ public RadioGroup.OnCheckedChangeListener radioGroupChangeListener = new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
+ Log.d(TAG, "onCheckedChanged()");
+ // Is the button now checked?
// boolean checked = ((RadioButton) view).isChecked();
- // Check which radio button was clicked
- switch (checkedId) {
- case R.id.chooseVanilla:
+ // Check which radio button was clicked
+ switch (checkedId) {
+ case R.id.chooseVanilla:
- Log.d(TAG, "onCheckedChanged() -- chooseVanilla");
- //determine if user chose vanilla or demotivational
+ Log.d(TAG, "onCheckedChanged() -- chooseVanilla");
+ //determine if user chose vanilla or demotivational
- vanilla = true;
- img = (ImageView) findViewById(R.id.sampleImageHolder);
- img.setImageResource(R.drawable.vanilla_animation);
+ vanilla = true;
+ img = (ImageView) findViewById(R.id.sampleImageHolder);
+ img.setImageResource(R.drawable.vanilla_animation);
- frameAnimation = (AnimationDrawable) img.getDrawable();
+ frameAnimation = (AnimationDrawable) img.getDrawable();
- frameAnimation.start();
- break;
- case R.id.chooseDemotivational:
+ frameAnimation.start();
+ break;
+ case R.id.chooseDemotivational:
- Log.d(TAG, "onCheckedChanged() -- chooseDemotivational");
- //determine if user chose vanilla or demotivational
- vanilla = false;
- img = (ImageView) findViewById(R.id.sampleImageHolder);
- img.setImageResource(R.drawable.demotivational_animation);
+ Log.d(TAG, "onCheckedChanged() -- chooseDemotivational");
+ //determine if user chose vanilla or demotivational
+ vanilla = false;
+ img = (ImageView) findViewById(R.id.sampleImageHolder);
+ img.setImageResource(R.drawable.demotivational_animation);
- frameAnimation = (AnimationDrawable) img.getDrawable();
+ frameAnimation = (AnimationDrawable) img.getDrawable();
- frameAnimation.start();
- break;
- }
+ frameAnimation.start();
+ break;
}
- });
-
- group.check(R.id.chooseDemotivational);
+ }
+ };
- nextButton = (Button) findViewById(R.id.nextButton);
- nextButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
-
- if (vanilla) {
- Intent vanillameme = new Intent(ChooseMemeStyle.this,VanillaMeme.class);
- vanillameme.putExtra("imgFilePath",imgFilePath);
- startActivity(vanillameme);
- }
- else {
- Intent demotivationalMeme = new Intent(ChooseMemeStyle.this, DemotivationalMemeActivity.class);
- demotivationalMeme.putExtra("imgFilePath",imgFilePath);
- startActivity(demotivationalMeme);
- }
- }
- });
+ public void nextButtonOnClick (View view) {
+ if (vanilla) {
+ Intent vanillameme = new Intent(ChooseMemeStyle.this,VanillaMeme.class);
+ vanillameme.putExtra("imgFilePath",imgFilePath);
+ startActivity(vanillameme);
+ }
+ else {
+ Intent demotivationalMeme = new Intent(ChooseMemeStyle.this, DemotivationalMemeActivity.class);
+ demotivationalMeme.putExtra("imgFilePath",imgFilePath);
+ startActivity(demotivationalMeme);
+ }
}
+
+
}
diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/DemotivationalMemeActivity.java b/app/src/main/java/meme5/c4q/nyc/meme_project/DemotivationalMemeActivity.java
index 0f8ad99..10bc290 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/DemotivationalMemeActivity.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/DemotivationalMemeActivity.java
@@ -11,7 +11,6 @@
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
-import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
@@ -36,6 +35,14 @@ protected void onCreate(Bundle savedInstanceState) {
preview = (ImageView) findViewById(R.id.preview);
+ getMeme();
+
+ largeText = (EditText) findViewById(R.id.large);
+ smallText = (EditText) findViewById(R.id.small);
+
+ }
+
+ public void getMeme() {
String imgFilePath = "";
Bundle bundle = getIntent().getExtras();
if(bundle.getString("imgFilePath") != null)
@@ -43,18 +50,12 @@ protected void onCreate(Bundle savedInstanceState) {
imgFilePath = bundle.getString("imgFilePath");
decodeFile(imgFilePath);
}
+ }
- largeText = (EditText) findViewById(R.id.large);
- smallText = (EditText) findViewById(R.id.small);
- Button previewText = (Button) findViewById(R.id.previewText);
- previewText.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- memeImage = drawTextToBitmap(image.copy(image.getConfig(),true),largeText.getText().toString(),true);
- memeImage = drawTextToBitmap(memeImage,smallText.getText().toString(),false);
- preview.setImageBitmap(memeImage);
- }
- });
+ public void previewTextOnClick (View view) {
+ memeImage = drawTextToBitmap(image.copy(image.getConfig(),true),largeText.getText().toString(),true);
+ memeImage = drawTextToBitmap(memeImage,smallText.getText().toString(),false);
+ preview.setImageBitmap(memeImage);
}
public void launchLastActivity(View view){
diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/MainActivity.java b/app/src/main/java/meme5/c4q/nyc/meme_project/MainActivity.java
index 75eafdf..b7baf43 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/MainActivity.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/MainActivity.java
@@ -1,17 +1,17 @@
package meme5.c4q.nyc.meme_project;
import android.app.Activity;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.widget.TextView;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
-import android.provider.MediaStore;
import android.os.Bundle;
-import android.widget.Toast;
+import android.provider.MediaStore;
import android.view.View;
+import android.widget.Toast;
+
+//user chooses whether to take picture from gallery, or camera for meme
+//todo: create option where user can choose a meme type image.
public class MainActivity extends Activity {
private static final int RESULT_LOAD_IMG = 1;
private static final int REQUEST_IMAGE_CAPTURE = 1;
@@ -23,6 +23,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
}
+
private void launchChooseMeme(){
Intent chooseMeme = new Intent(this,ChooseMemeStyle.class);
chooseMeme.putExtra("imgFilePath",imgFilePath);
diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/SplashScreen.java b/app/src/main/java/meme5/c4q/nyc/meme_project/SplashScreen.java
index 3d1beab..8618b98 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/SplashScreen.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/SplashScreen.java
@@ -5,14 +5,12 @@
*/
import android.app.Activity;
import android.content.Intent;
-import android.graphics.Typeface;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
-import android.view.Menu;
import android.widget.ImageView;
-import android.widget.TextView;
+//intro to app screen
public class SplashScreen extends Activity {
/** Duration of wait **/
diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/VanillaMeme.java b/app/src/main/java/meme5/c4q/nyc/meme_project/VanillaMeme.java
index b3ff942..3ec4c02 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/VanillaMeme.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/VanillaMeme.java
@@ -3,7 +3,6 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
@@ -15,7 +14,6 @@
import android.text.StaticLayout;
import android.text.TextPaint;
import android.view.View;
-import android.view.ViewTreeObserver;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
@@ -23,8 +21,6 @@
import android.widget.RadioGroup;
import android.widget.TextView;
-import org.w3c.dom.Text;
-
import java.io.FileOutputStream;
@@ -44,12 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vanilla_meme);
- //get image path from previous activity
- Bundle bundle = getIntent().getExtras();
- if (bundle.getString("imgFilePath") != null) {
- imgFilePath = bundle.getString("imgFilePath");
- decodeFile(imgFilePath);
- }
+ getMeme();
line1 = (EditText) findViewById(R.id.top);
image = (ImageView) findViewById(R.id.testImage);
@@ -59,7 +50,25 @@ protected void onCreate(Bundle savedInstanceState) {
medium = (RadioButton) findViewById(R.id.medium);
large = (RadioButton) findViewById(R.id.large);
+ applyFont();
+ //create on check listener to see which size is chosen
+ RadioGroup group = (RadioGroup) findViewById(R.id.textSizes);
+ group.setOnCheckedChangeListener(radioGroupChangeListener);
+ group.check(R.id.small);
+
+ }
+
+ public void getMeme(){
+ //get image path from previous activity
+ Bundle bundle = getIntent().getExtras();
+ if (bundle.getString("imgFilePath") != null) {
+ imgFilePath = bundle.getString("imgFilePath");
+ decodeFile(imgFilePath);
+ }
+ }
+
+ public void applyFont(){
//apply font
Typeface tf = Typeface.createFromAsset(getApplicationContext().getAssets(), "fonts/ubuntu.ttf");
title.setTypeface(tf);
@@ -68,32 +77,29 @@ protected void onCreate(Bundle savedInstanceState) {
large.setTypeface(tf);
line1.setTypeface(tf);
nextButton.setTypeface(tf);
+ }
- //create on check listener to see which size is chosen
- RadioGroup group = (RadioGroup) findViewById(R.id.textSizes);
- group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
-
- line1Text = line1.getText().toString();
-
- switch (checkedId) {
- case R.id.small:
- bmp = drawTextToBitmap(bmp2, line1Text, 40, 2);
- image.setImageBitmap(bmp);
- break;
- case R.id.medium:
- bmp = drawTextToBitmap(bmp2, line1Text, 55, 3);
- image.setImageBitmap(bmp);
- break;
- case R.id.large:
- bmp = drawTextToBitmap(bmp2, line1Text, 80, 4);
- image.setImageBitmap(bmp);
- break;
- }
+ public RadioGroup.OnCheckedChangeListener radioGroupChangeListener = new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
+ line1Text = line1.getText().toString();
+
+ switch (checkedId) {
+ case R.id.small:
+ bmp = drawTextToBitmap(bmp2, line1Text, 40, 2);
+ image.setImageBitmap(bmp);
+ break;
+ case R.id.medium:
+ bmp = drawTextToBitmap(bmp2, line1Text, 55, 3);
+ image.setImageBitmap(bmp);
+ break;
+ case R.id.large:
+ bmp = drawTextToBitmap(bmp2, line1Text, 80, 4);
+ image.setImageBitmap(bmp);
+ break;
}
- });
- }
+ }
+ };
//method used to write text on image
public Bitmap drawTextToBitmap(Bitmap bitmap, String mText1, int textSize, int strokeSize) {
diff --git a/app/src/main/java/meme5/c4q/nyc/meme_project/add_text.java b/app/src/main/java/meme5/c4q/nyc/meme_project/add_text.java
index cffe1fc..a1c933e 100644
--- a/app/src/main/java/meme5/c4q/nyc/meme_project/add_text.java
+++ b/app/src/main/java/meme5/c4q/nyc/meme_project/add_text.java
@@ -3,17 +3,13 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.media.Image;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Environment;
+import android.provider.MediaStore;
import android.support.v7.app.ActionBarActivity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
import android.view.View;
-import android.widget.EditText;
import android.widget.ImageView;
-import android.provider.MediaStore;
import android.widget.Toast;
import java.io.ByteArrayOutputStream;
@@ -22,22 +18,21 @@
import java.io.FileOutputStream;
import java.io.IOException;
-
+//activity allows user to save or share meme created
public class add_text extends ActionBarActivity {
Bitmap memeImage;
- ImageView share;
- ImageView save;
- ImageView preview;
- Bitmap previewMeme;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_text);
+ getMeme();
+ }
+ public void getMeme () {
String filename = getIntent().getStringExtra("memeImage");
try {
FileInputStream is = this.openFileInput(filename);
@@ -46,36 +41,27 @@ protected void onCreate(Bundle savedInstanceState) {
} catch (Exception e) {
e.printStackTrace();
}
-
ImageView previewMeme = (ImageView) findViewById(R.id.previewMeme);
if(memeImage != null) {
previewMeme.setImageBitmap(memeImage);
}
+ }
- share = (ImageView) findViewById(R.id.shareButton);
- share.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
-
- Intent share = new Intent(Intent.ACTION_SEND);
- share.setType("image/jpeg");
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- memeImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
- File f = new File(Environment.getExternalStorageDirectory() + File.separator + "temporary_file.jpg");
- try {
- f.createNewFile();
- FileOutputStream fo = new FileOutputStream(f);
- fo.write(bytes.toByteArray());
- } catch (IOException e) {
- e.printStackTrace();
- }
- share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/temporary_file.jpg"));
- startActivity(Intent.createChooser(share, "Share Image"));
-
-
- }
- });
-
+ public void shareImage(View view) {
+ Intent share = new Intent(Intent.ACTION_SEND);
+ share.setType("image/jpeg");
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ memeImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes);
+ File f = new File(Environment.getExternalStorageDirectory() + File.separator + "temporary_file.jpg");
+ try {
+ f.createNewFile();
+ FileOutputStream fo = new FileOutputStream(f);
+ fo.write(bytes.toByteArray());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ share.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/temporary_file.jpg"));
+ startActivity(Intent.createChooser(share, "Share Image"));
}
public void saveImage(View view) {
@@ -83,26 +69,4 @@ public void saveImage(View view) {
Toast.makeText(this, "Meme saved!", Toast.LENGTH_LONG).show();
}
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_add_text, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
-
- //noinspection SimplifiableIfStatement
- if (id == R.id.action_settings) {
- return true;
- }
-
- return super.onOptionsItemSelected(item);
- }
-
}
diff --git a/app/src/main/res/layout-land/activity_add_text.xml b/app/src/main/res/layout-land/activity_add_text.xml
index e4be82f..d61c959 100644
--- a/app/src/main/res/layout-land/activity_add_text.xml
+++ b/app/src/main/res/layout-land/activity_add_text.xml
@@ -75,9 +75,7 @@
android:id="@+id/previewMeme"
android:layout_width="300dp"
android:layout_height="300dp"
- android:layout_gravity="center"
-
- />
+ android:layout_gravity="center"/>
-
-
-
+ android:src="@drawable/sharestroke"/>
+ android:layout_marginTop="30dp"/>
-
diff --git a/app/src/main/res/layout-land/activity_choose_meme_style.xml b/app/src/main/res/layout-land/activity_choose_meme_style.xml
index 5cd25d3..ec97c8f 100644
--- a/app/src/main/res/layout-land/activity_choose_meme_style.xml
+++ b/app/src/main/res/layout-land/activity_choose_meme_style.xml
@@ -124,10 +124,13 @@
diff --git a/app/src/main/res/layout-land/activity_vanilla_meme.xml b/app/src/main/res/layout-land/activity_vanilla_meme.xml
index 4cc9762..1ac311b 100644
--- a/app/src/main/res/layout-land/activity_vanilla_meme.xml
+++ b/app/src/main/res/layout-land/activity_vanilla_meme.xml
@@ -87,6 +87,8 @@
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:textColor="#fff"
+ android:textSize="20dp"
android:text="Next"
android:id="@+id/next"
android:onClick="launchLastActivity"
diff --git a/app/src/main/res/layout/activity_add_text.xml b/app/src/main/res/layout/activity_add_text.xml
index 4b9ea6b..cf7a906 100644
--- a/app/src/main/res/layout/activity_add_text.xml
+++ b/app/src/main/res/layout/activity_add_text.xml
@@ -72,7 +72,6 @@
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_gravity="center"
-
/>
diff --git a/app/src/main/res/layout/activity_demotivational_meme.xml b/app/src/main/res/layout/activity_demotivational_meme.xml
index 46c2855..4c37676 100644
--- a/app/src/main/res/layout/activity_demotivational_meme.xml
+++ b/app/src/main/res/layout/activity_demotivational_meme.xml
@@ -49,7 +49,10 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
+ android:textColor="#fff"
+ android:textSize="20dp"
android:text="Preview Text"
+ android:onClick="previewTextOnClick"
android:id="@+id/previewText"
android:layout_gravity="center_horizontal" />
@@ -58,6 +61,8 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
+ android:textColor="#fff"
+ android:textSize="20dp"
android:text="Next"
android:id="@+id/next"
android:layout_gravity="center_horizontal"
diff --git a/app/src/main/res/layout/activity_vanilla_meme.xml b/app/src/main/res/layout/activity_vanilla_meme.xml
index 631b454..3e4e21c 100644
--- a/app/src/main/res/layout/activity_vanilla_meme.xml
+++ b/app/src/main/res/layout/activity_vanilla_meme.xml
@@ -76,6 +76,8 @@
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:textColor="#fff"
+ android:textSize="20dp"
android:text="Next"
android:id="@+id/next"
android:onClick="launchLastActivity"